ForestVPN
Technology

How to Clear DNS Cache on Windows, macOS, Linux & Android

Flush your DNS cache on Windows, macOS, Linux, or Android with these simple commands and restore fast, reliable internet connections.

10 мин чтения
How to Clear DNS Cache on Windows, macOS, Linux & Android

Clear Your System’s DNS Cache: A Comprehensive Guide

Why You Should Clear DNS Cache

When you visit websites, your computer stores DNS records in a local cache to speed up future lookups. Over time, these records can become stale or corrupted, causing slow connections, failed logins, or blocked sites. Clearing the cache forces your system to fetch fresh records from DNS servers, often resolving connectivity problems quickly.

Windows

  1. Open Command Prompt as Administrator.
  2. Run the following command:
typescript
1ipconfig /flushdns
  1. You should see a confirmation: “Successfully flushed the DNS Resolver Cache.”

macOS

  1. Open Terminal.
  2. Depending on your macOS version, run one of the following commands:
bash
1# macOS 10.15 Catalina and later
2 dscacheutil -flushcache; killall -HUP mDNSResponder
3
4 # macOS 10.14 Mojave and earlier
5 killall -HUP mDNSResponder
  1. Enter your password when prompted. No confirmation message is shown, but the cache is cleared.

Linux

The command varies with the distribution and DNS service in use.

Ubuntu / Debian / Fedora (systemd‑resolved)

bash
1sudo systemd-resolve --flush-caches

Ubuntu / Debian (dnsmasq)

bash
1sudo service dnsmasq restart

Fedora (NetworkManager)

bash
1sudo nmcli networking off && sudo nmcli networking on

Android

  1. Go to SettingsApps[Your Browser or App]Storage.
  2. Tap Clear Cache. Alternatively, you can reset all DNS settings by toggling the device’s Airplane mode on and off, which clears the DNS cache for the mobile network.

Verifying the Flush

After clearing the cache, confirm it worked by performing a DNS lookup:

bash
1nslookup example.com

If the IP address returned differs from the one you previously saw, the cache has been refreshed. You can also ping a site:

bash
1ping -c 4 example.com

Consistent IP addresses after a flush indicate the cache is cleared.

Troubleshooting Persistent DNS Issues

  • Restart the router: Power‑cycling your modem and router often resolves lingering DNS problems.
  • Change DNS servers: Switch to a public DNS provider such as Cloudflare (1.1.1.1) or Google Public DNS (8.8.8.8).
  • Check firewall settings: Ensure that outbound DNS traffic (UDP/TCP port 53) is not blocked by a firewall or security suite.
  • Update network drivers: Outdated drivers can cause DNS resolution failures on Windows and Linux.

Summary Table

Operating System

Command to Flush DNS

Windows

ipconfig /flushdns

macOS

dscacheutil -flushcache; killall -HUP mDNSResponder

Ubuntu/Debian

sudo systemd-resolve --flush-caches

Fedora

sudo nmcli networking off && sudo nmcli networking on

Android

Clear app cache or toggle Airplane mode

By following these steps, you’ll eliminate stale DNS entries, improve connectivity, and reduce frustration with slow or blocked internet access.

Clear Your System’s DNS Cache

Why Flushing DNS Matters

When you visit websites, your computer stores DNS records so it can look them up faster next time. Over time those records can get stale or corrupted, which can cause connectivity hiccups, wrong redirects, or security warnings. Clearing the DNS cache forces the system to fetch fresh records, and that usually fixes the problem.

How to Flush DNS on Windows

  1. Open Command Prompt as an administrator.
  2. Type:
bash
1ipconfig /flushdns
2 ```
33. You’ll see a confirmation: *“Successfully flushed the DNS Resolver Cache.”*
4
5### How to Flush DNS on macOS
61. Launch **Terminal**.
72. Run the command that matches your macOS version:
8
9 | macOS Version | Command |
10 |---------------|---------|
11 | Monterey & later | `sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder` |
12 | Big Sur & Catalina | `sudo killall -HUP mDNSResponder` |
13 | Mojave & earlier | `sudo killall -HUP mDNSResponder; sudo dscacheutil -flushcache` |
14
153. Enter your password when prompted. A silent success means the cache is cleared.
16
17### How to Flush DNS on Linux (Fedora and Others)
181. Open a terminal window.
192. Depending on your distro’s DNS service, run one of these:
20
21 | Distribution | Command |
22 |--------------|---------|
23 | Fedora, CentOS 8+, RHEL 8+ | `sudo systemd-resolve --flush-caches` |
24 | Ubuntu, Debian | `sudo systemd-resolve --flush-caches` or `sudo /etc/init.d/nscd restart` |
25 | Arch, Manjaro | `sudo systemd-resolve --flush-caches` |
26
273. Verify with `systemd-resolve --statistics` or `nscd -g` for older setups.
28
29### How to Flush DNS on Android
301. Open the **Settings** app.
312. Go to **Apps** → **[Your VPN or Browser]** → **Storage** → **Clear cache** *(this clears app cache, not DNS)*.
323. To clear the system DNS cache, restart the device or toggle airplane mode on and off.
33
34### Verifying the Flush
35After you finish, double‑check that stale entries are gone:
36
37- **nslookup**:

nslookup example.com

typescript
1The output should show the correct IP and a *"Non-authoritative answer"* line.
2
3- **ping**:

ping -c 4 example.com

typescript
1The returned IP should match the expected address.
2
3If the IP changes after the flush, the cache has been successfully cleared.
4
5### Troubleshooting Persistent DNS Issues
6- **Restart your router**: Modem or router firmware may still hold cached entries.
7- **Try a reputable public DNS** (e.g., Google DNS `8.8.8.8`, Cloudflare `1.1.1.1`).
8- **Disable VPN or proxy** temporarily to see if they’re causing trouble.
9- **Check the host file**: Make sure `/etc/hosts` (Linux/macOS) or `C:\\Windows\\System32\\drivers\\etc\\hosts` (Windows) doesn’t contain conflicting entries.
10
11### Frequently Asked Questions
12
13**Q: How often should I clear my DNS cache?**
14A: Only when you encounter connectivity problems or suspect stale records.
15
16**Q: Does clearing DNS affect my browsing history?**
17A: No. DNS cache only stores domain‑to‑IP mappings, not visited sites.
18
19**Q: Can I automate DNS flushing?**
20A: Yes—create a script or use systemd timers on Linux, batch files on Windows, or Automator workflows on macOS.
21
22By clearing your DNS cache whenever it’s needed, you keep the internet experience smoother and more reliable.
23
24# Clear Your System’s DNS Cache
25
26## Why DNS Caching Matters
27
28DNS caching speeds up name resolution by storing recent lookups. When an entry becomes stale, you may see broken sites, slow connections, or blocked content. Flushing the cache forces your system to retrieve fresh records.
29
30## Windows
31
32Open Command Prompt as Administrator and run:
33
34```bat
35ipconfig /flushdns

You should see a confirmation message.

macOS

Open Terminal and enter:

bash
1sudo killall -HUP mDNSResponder

Enter your password when prompted.

Linux (Fedora)

Fedora uses systemd-resolved. Flush the cache with:

bash
1sudo systemd-resolve --flush-caches

Android

Android doesn’t expose a direct command, but you can:

  1. Clear DNS cache via Settings – Go to Settings → Apps → [Your Browser] → Storage → Clear Cache.
  2. Reboot the device – A reboot clears the DNS cache.
  3. Use a terminal app – If you have termux, run ping -c 1 google.com to force a fresh lookup.

Verify the Flush

Use nslookup or ping to confirm the cache is cleared. For example:

typescript
1nslookup example.com

or

typescript
1ping -c 4 example.com

The response time should reflect the current network latency.

Troubleshooting Persistent DNS Issues

  • Restart your router or modem.
  • Switch to a reputable DNS provider such as Google DNS (8.8.8.8, 8.8.4.4) or Cloudflare (1.1.1.1).
  • Ensure no VPN or firewall is blocking DNS traffic.
  • Verify your network adapter settings are correct.

Recommended Reputable DNS Providers

Provider

Primary IP

Secondary IP

Google DNS

8.8.8.8

8.8.4.4

Cloudflare DNS

1.1.1.1

1.0.0.1

OpenDNS

208.67.222.222

208.67.220.220

These providers offer fast, reliable DNS resolution with added security features.


Ready to boost your internet speed and reliability? Try clearing your DNS cache today and experience a smoother connection. For more advanced tips, check out our detailed troubleshooting guide.

Getting Started: How to Clear Your System’s DNS Cache

DNS caching is a quick‑fire performance trick that keeps domain look‑ups on your machine, so web pages load faster. When the cached data gets old or messed up, you can see broken links, weird redirects, or even security glitches. Flushing the cache forces your OS to fetch fresh records from the authoritative DNS servers.

Windows

  1. Open Command Prompt as administrator.
  2. Type: ipconfig /flushdns and press Enter.
  3. You should see: Successfully flushed the DNS Resolver Cache.

macOS

  1. Open Terminal.
  2. Run: sudo killall -HUP mDNSResponder (macOS Monterey and later).
  3. Enter your password if prompted.
  4. Confirm with: echo DNS cache cleared.

Linux (Fedora)

  1. Open a terminal.
  2. Execute: sudo systemd-resolve --flush-caches.
  3. Verify with: systemd-resolve --statistics (look for Cache size reset).

Android

  1. Open SettingsApps.
  2. Tap the three dots → Reset app preferences.
  3. Or use a terminal app and run:
typescript
1su
2 flushdns
3 exit

Verify the Flush

  • Open a terminal or command prompt.
  • Run nslookup example.com or ping -c 4 example.com.
  • If the IP resolves correctly and no stale entries pop up, the cache is cleared.

Troubleshooting

  • Persistent DNS errors: Restart your router or switch to a public DNS such as Google (8.8.8.8) or Cloudflare (1.1.1.1).
  • No change after flush: Make sure no VPN or proxy is overriding your DNS settings.
  • Browser‑specific issues: Clear the browser’s own DNS cache or try incognito mode.

OS

Command to Flush DNS

Verification Command

Windows

ipconfig /flushdns

ipconfig /displaydns

macOS

sudo killall -HUP mDNSResponder

dscacheutil -cachedump

Linux (Fedora)

sudo systemd-resolve --flush-caches

systemd-resolve --statistics

Android

Reset app preferences or flushdns via terminal

ping example.com

If you’re looking for even faster and more reliable DNS resolution, give a reputable public provider a try—Google DNS, Cloudflare DNS, or OpenDNS. They’re known for better speed, stronger security, and worldwide coverage.

Clear Your System’s DNS Cache

DNS caching can slow your connection and spit out stale results. Flushing the cache on each platform gives you fresh, accurate data—especially handy when you’re using a VPN like Forest VPN, which depends on quick, reliable DNS resolution.

Windows

  1. Open Command Prompt as an administrator.
  2. Run:
typescript
1ipconfig /flushdns
  1. You should see a confirmation: "Successfully flushed the DNS Resolver Cache."

macOS

  1. Open Terminal.
  2. Depending on your macOS version, run one of the following:
  • macOS Mojave or earlier:
bash
1sudo killall -HUP mDNSResponder
  • macOS Sierra through High Sierra:
bash
1sudo killall -HUP mDNSResponder
  • macOS Catalina and later:
bash
1sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
  1. Enter your password when prompted.

Linux (Fedora)

  1. Open a terminal.
  2. Run:
bash
1sudo systemd-resolve --flush-caches

or, if you use NetworkManager:

bash
1sudo systemctl restart NetworkManager

Android

  1. Open the Settings app.
  2. Tap Apps[Your Browser]Storage.
  3. Tap Clear Cache.
    (For a system‑wide DNS flush, go to Developer optionsClear DNS cache if available.)

Verify the Flush

After clearing, make sure DNS queries resolve correctly:

  • Open a terminal or command prompt.
  • Run a simple lookup:
bash
1nslookup example.com

or

typescript
1ping example.com
  • The response should show the correct IP address with no error messages.

Troubleshooting Persistent DNS Issues

  • Restart the router if you’re still seeing stale entries.
  • Disable third‑party DNS services in your system settings; rely on the default or a reputable provider like Cloudflare (1.1.1.1) or Google (8.8.8.8).
  • Check VPN settings: Forest VPN offers a built‑in DNS leak‑check; ensure it’s enabled so that your DNS queries stay within the encrypted tunnel.

Summary Table

Operating System

Command to Flush DNS

Notes

Windows

ipconfig /flushdns

Run as administrator

macOS (Mojave or earlier)

sudo killall -HUP mDNSResponder

Requires password

macOS (Catalina or later)

sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder

Two commands

Linux (Fedora)

sudo systemd-resolve --flush-caches

Or restart NetworkManager

Android

Clear cache in app settings or use Developer options

No command line

Forest VPN: Fast, Secure DNS

When you’re connected to Forest VPN, your DNS queries are routed through their secure, no‑log servers. Clearing your local cache first cuts down the chance of stale entries leaking outside the VPN, so every request lands on Forest’s fast, privacy‑focused DNS infrastructure. Combined with AES‑256 encryption and a strict no‑log policy, Forest VPN delivers a connection that’s both lightning‑fast and fully protected.

Feel confident that your network is clean and your privacy intact—just another step toward a smoother, safer browsing experience with Forest VPN. Download the app today and enjoy the benefits of a freshly cleared DNS cache and a secure, high‑performance VPN connection.

Clear Your System’s DNS Cache

If your internet keeps hiccuping, a quick DNS cache flush can be the fix. This guide walks you through the steps for Windows, macOS, Linux (Fedora), and Android.

Why DNS Caching Happens

DNS caching saves the results of recent lookups so future requests are faster. When a record changes, the cached entry can get stale, which leads to connection problems or wrong routing. Flushing the cache forces the system to pull fresh data from your DNS provider.

Windows

  1. Open a Command Prompt as administrator.
  2. Run:
typescript
1ipconfig /flushdns
  1. You should see: Successfully flushed the DNS Resolver Cache.

macOS

  1. Open Terminal.
  2. Run the command that matches your version:
bash
1# macOS Big Sur (11.x) and later
2 sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
bash
1# macOS Mojave (10.14) and earlier
2 sudo killall -HUP mDNSResponder
  1. Enter your password when prompted.

Linux (Fedora)

  1. Open a terminal.
  2. Run:
bash
1sudo systemd-resolve --flush-caches
  1. Check the status to make sure it worked:
bash
1systemd-resolve --statistics

Android

  1. Open Settings.
  2. Tap Apps or Apps & notifications.
  3. Find the app that handles DNS (often your browser or a VPN app).
  4. Tap Storage & cache.
  5. Tap Clear cache.

If your device is rooted, you can also flush DNS from ADB:

bash
1adb shell ndc resolver flush

Verifying the Flush

After you’ve cleared the cache, confirm it’s gone:

  • nslookup: Run nslookup example.com and watch how long it takes.
  • ping: Run ping example.com and see if the IP matches your DNS provider.

If you still see old IPs or keep hitting failures, the cache may not have cleared properly.

Troubleshooting Persistent DNS Issues

  • Restart Your Router – the router can keep its own DNS cache.
  • Check for DNS Leaks – tools like dnsleaktest.com can help you verify your traffic stays private.
  • Switch to a Reputable DNS Provider:
  • Cloudflare (1.1.1.1) – fast and privacy‑focused.
  • Quad9 (9.9.9.9) – blocks malicious domains.
  • Google Public DNS (8.8.8.8) – widely available.

Forest VPN: A Quick DNS Switcher

Forest VPN lets you change your DNS provider with a single tap. Whether you want Cloudflare, Quad9, or a custom DNS, the app’s Advanced Settings panel makes it effortless. For power users, features like Multi‑Hop routing, Dedicated IPs, and API access give granular control without sacrificing simplicity.

Testimonial "After switching to Forest VPN and setting Cloudflare as my DNS, my browsing speed improved noticeably, and I no longer get those annoying captive‑portal pop‑ups.” – Alex, IT support

Call to Action

Ready to take control of your DNS and protect your privacy? Download Forest VPN today and enjoy a faster, safer internet connection with just one tap.


Download Forest VPN


Join the Forest VPN Community: Exclusive Offers and Next Steps

Privacy often feels like a fortress of firewalls and encrypted tunnels. Yet sometimes the simplest fix is clearing the path behind our devices. At Forest VPN we’ve noticed a fresh DNS cache feels like clean air, letting data flow straight through.

Why Flush Your DNS Cache?

DNS caching holds the addresses of sites you’ve visited recently. Stale entries can send you to the wrong server or make a domain fail to resolve. By clearing the cache you force the system to ask DNS servers again, guaranteeing the latest IP addresses.

How to Flush DNS on Different Operating Systems

Windows

  1. Launch Command Prompt as an administrator.
  2. Enter ipconfig /flushdns.
  3. Hit Enter. A confirmation message should appear.

macOS

  1. Open Terminal.
  2. Run sudo killall -HUP mDNSResponder.
  3. Enter your password when prompted.

Linux (Fedora)

  1. Open a terminal.
  2. Execute sudo systemd-resolve --flush-caches.
  3. If needed, restart the network manager with sudo systemctl restart NetworkManager.

Android

  1. Open the Settings app.
  2. Tap Apps > [Your Browser].
  3. Go to Storage and tap Clear Cache.
  4. Or, use a terminal emulator and run ndc resolver flush.

Verify the Flush

Run nslookup example.com or ping -c 4 example.com.
If the response shows the correct IP address, the cache is cleared.

Troubleshooting Persistent DNS Issues

  • Restart the router – power‑cycle it if DNS issues keep happening.
  • Change DNS servers – try a public provider like Cloudflare (1.1.1.1) or Google (8.8.8.8).
  • Look for malware – some bad software hijacks DNS; run a trusted antivirus scan.

Summary

Flushing the DNS cache is a fast and effective fix for many connectivity hiccups. It’s particularly handy when you switch networks or after a system update.

Ready to boost your online experience? Grab Forest VPN’s 14‑day free trial and enjoy secure, fast browsing. Dive into our forums for tips, tutorials, and quick support. The community is waiting.


All commands are shared for educational purposes. Check that they work on your system before running them.

TechnologyNetworkingDNS Management