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.

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
- Open Command Prompt as Administrator.
- Run the following command:
1ipconfig /flushdns- You should see a confirmation: “Successfully flushed the DNS Resolver Cache.”
macOS
- Open Terminal.
- Depending on your macOS version, run one of the following commands:
1# macOS 10.15 Catalina and later2 dscacheutil -flushcache; killall -HUP mDNSResponder3
4 # macOS 10.14 Mojave and earlier5 killall -HUP mDNSResponder- 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)
1sudo systemd-resolve --flush-cachesUbuntu / Debian (dnsmasq)
1sudo service dnsmasq restartFedora (NetworkManager)
1sudo nmcli networking off && sudo nmcli networking onAndroid
- Go to Settings → Apps → [Your Browser or App] → Storage.
- 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:
1nslookup example.comIf the IP address returned differs from the one you previously saw, the cache has been refreshed. You can also ping a site:
1ping -c 4 example.comConsistent 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 | |
macOS | |
Ubuntu/Debian | |
Fedora | |
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
- Open Command Prompt as an administrator.
- Type:
1ipconfig /flushdns2 ``` 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
1The output should show the correct IP and a *"Non-authoritative answer"* line.2
3- **ping**:ping -c 4 example.com
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 Cache25
26## Why DNS Caching Matters27
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## Windows31
32Open Command Prompt as Administrator and run:33
34```bat35ipconfig /flushdnsYou should see a confirmation message.
macOS
Open Terminal and enter:
1sudo killall -HUP mDNSResponderEnter your password when prompted.
Linux (Fedora)
Fedora uses systemd-resolved. Flush the cache with:
1sudo systemd-resolve --flush-cachesAndroid
Android doesn’t expose a direct command, but you can:
- Clear DNS cache via Settings – Go to Settings → Apps → [Your Browser] → Storage → Clear Cache.
- Reboot the device – A reboot clears the DNS cache.
- Use a terminal app – If you have
termux, runping -c 1 google.comto force a fresh lookup.
Verify the Flush
Use nslookup or ping to confirm the cache is cleared. For example:
1nslookup example.comor
1ping -c 4 example.comThe 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
- Open Command Prompt as administrator.
- Type:
ipconfig /flushdnsand press Enter. - You should see: Successfully flushed the DNS Resolver Cache.
macOS
- Open Terminal.
- Run:
sudo killall -HUP mDNSResponder(macOS Monterey and later). - Enter your password if prompted.
- Confirm with:
echo DNS cache cleared.
Linux (Fedora)
- Open a terminal.
- Execute:
sudo systemd-resolve --flush-caches. - Verify with:
systemd-resolve --statistics(look for Cache size reset).
Android
- Open Settings → Apps.
- Tap the three dots → Reset app preferences.
- Or use a terminal app and run:
1su2 flushdns3 exitVerify the Flush
- Open a terminal or command prompt.
- Run
nslookup example.comorping -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 | | |
macOS | | |
Linux (Fedora) | | |
Android | Reset app preferences or | |
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
- Open Command Prompt as an administrator.
- Run:
1ipconfig /flushdns- You should see a confirmation: "Successfully flushed the DNS Resolver Cache."
macOS
- Open Terminal.
- Depending on your macOS version, run one of the following:
- macOS Mojave or earlier:
1sudo killall -HUP mDNSResponder- macOS Sierra through High Sierra:
1sudo killall -HUP mDNSResponder- macOS Catalina and later:
1sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder- Enter your password when prompted.
Linux (Fedora)
- Open a terminal.
- Run:
1sudo systemd-resolve --flush-cachesor, if you use NetworkManager:
1sudo systemctl restart NetworkManagerAndroid
- Open the Settings app.
- Tap Apps → [Your Browser] → Storage.
- Tap Clear Cache.
(For a system‑wide DNS flush, go to Developer options → Clear 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:
1nslookup example.comor
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 | | Run as administrator |
macOS (Mojave or earlier) | | Requires password |
macOS (Catalina or later) | | Two commands |
Linux (Fedora) | | 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
- Open a Command Prompt as administrator.
- Run:
1ipconfig /flushdns- You should see: Successfully flushed the DNS Resolver Cache.
macOS
- Open Terminal.
- Run the command that matches your version:
1# macOS Big Sur (11.x) and later2 sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder1# macOS Mojave (10.14) and earlier2 sudo killall -HUP mDNSResponder- Enter your password when prompted.
Linux (Fedora)
- Open a terminal.
- Run:
1sudo systemd-resolve --flush-caches- Check the status to make sure it worked:
1systemd-resolve --statisticsAndroid
- Open Settings.
- Tap Apps or Apps & notifications.
- Find the app that handles DNS (often your browser or a VPN app).
- Tap Storage & cache.
- Tap Clear cache.
If your device is rooted, you can also flush DNS from ADB:
1adb shell ndc resolver flushVerifying the Flush
After you’ve cleared the cache, confirm it’s gone:
- nslookup: Run
nslookup example.comand watch how long it takes. - ping: Run
ping example.comand 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.comcan 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.
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
- Launch Command Prompt as an administrator.
- Enter
ipconfig /flushdns. - Hit Enter. A confirmation message should appear.
macOS
- Open Terminal.
- Run
sudo killall -HUP mDNSResponder. - Enter your password when prompted.
Linux (Fedora)
- Open a terminal.
- Execute
sudo systemd-resolve --flush-caches. - If needed, restart the network manager with
sudo systemctl restart NetworkManager.
Android
- Open the Settings app.
- Tap Apps > [Your Browser].
- Go to Storage and tap Clear Cache.
- 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.