How to Clear DNS Cache: Step-by-Step Guide for Windows, macOS, Linux, Browsers & Mobile

So you're trying to visit a website and it just won't load properly. Maybe it's showing an old version, or you're getting weird errors despite your internet working fine. Been there, done that – last Tuesday I spent 45 minutes troubleshooting a client's site before realizing my DNS cache was holding me hostage. Clearing DNS cache is one of those tech fixes that sounds complicated but takes 30 seconds once you know how. Let's cut through the jargon and get straight to fixing it.

What Exactly is DNS Cache and Why Would You Flush It?

Think of DNS like your phone's contacts app. When you type "mom" it instantly finds her number instead of making you remember digits. Similarly, DNS translates human-friendly domain names (like google.com) into computer-friendly IP addresses. Your system stores these translations locally in DNS cache for faster access.

But what happens when mom changes her number? Your phone keeps dialing the old one. DNS cache works the same way – if a website moves servers or updates IPs, your computer might keep using outdated info. That stale cache causes:

  • Sites loading outdated content (like seeing last week's product page)
  • "Site not found" errors despite others accessing it fine
  • SSL certificate errors due to mismatched IPs
  • Failed website migrations – I once panicked when a client's new server wasn't loading, only to realize my cache hadn't refreshed

When Should You Clear DNS Cache?

Usually when facing weird connectivity issues. But specifically:

  • After changing hosting providers or migrating sites
  • When DNS records were updated recently (A, CNAME changes)
  • Before running network diagnostics
  • If websites work on mobile data but not Wi-Fi

Pro tip: DNS cache clears automatically over time (usually 24-48 hours), but who wants to wait that long?

How to Clear DNS Cache on Windows Machines

Windows stores DNS cache in a hidden system database. Clearing it requires Command Prompt with admin rights. Here's how:

ipconfig /flushdns

If you see "Successfully flushed the DNS Resolver Cache," you're golden. But sometimes it fails – usually because Command Prompt wasn't run as administrator. Right-click > Run as administrator is crucial.

Honestly, Microsoft could make this easier. Why isn't there a "Clear DNS" button in network settings? Anyway, for different Windows versions:

Windows Version Command Notes
Windows 11/10 ipconfig /flushdns Works 95% of time if run as admin
Windows 8 ipconfig /flushdns Same as Windows 10
Windows 7 ipconfig /flushdns Sometimes requires service restart
Windows XP ipconfig /flushdns May need to restart "DNS Client" service

If flushing doesn't work, try restarting the DNS Client service:

  1. Type services.msc in Start menu
  2. Find "DNS Client" service
  3. Right-click > Restart

I've had corporate VPNs interfere with this – worth checking if you use one.

Clearing DNS Cache on macOS: Different Methods for Different Versions

Apple keeps changing how to flush DNS cache across macOS versions. Why? No idea. Here's what works now:

macOS Version Terminal Command Notes
Ventura (13.x) & Later sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder Run both commands
Monterey (12.x) sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder Same as Ventura
Big Sur (11.x) sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
Catalina (10.15) & Earlier sudo killall -HUP mDNSResponder Different responder name
# For modern macOS:
sudo dscacheutil -flushcache
sudo killall -HUP mDNSResponder

You'll be prompted for your administrator password after entering these commands. No success message? That's normal – macOS doesn't confirm completion. Annoying, but just test any problematic site.

Linux DNS Cache Clearing: Distribution-Specific Methods

Linux doesn't cache DNS by default unless you're using systemd-resolved, dnsmasq, or similar services. Here's how to clear DNS cache for common setups:

Service/Distro Command Effect
systemd-resolved (Ubuntu, Fedora) sudo systemd-resolve --flush-caches Clears systemd's resolver cache
dnsmasq sudo systemctl restart dnsmasq Must restart service
nscd (Name Service Caching Daemon) sudo systemctl restart nscd Restart required
BIND (named) sudo rndc flush Flushes BIND server cache

Important: Many Linux distributions don't enable local DNS caching by default. Check if you have any caching service installed before troubleshooting.

Verifying DNS Cache Clearance on Linux

For systemd-resolved:

systemd-resolve --statistics

Look for "Current Cache Size" – should be 0 after flush. If not, restart the service.

Clearing Browser-Specific DNS Cache

Sometimes the OS cache isn't the culprit. Browsers maintain their own DNS caches too. Here's how to clear them:

Google Chrome

  • Type chrome://net-internals/#dns in address bar
  • Click "Clear host cache" button
  • Bonus: Also clear socket pools under chrome://net-internals/#sockets

Honestly, Chrome's internal tools frustrate me. Why bury this under "net-internals"? At least it works.

Mozilla Firefox

  • Type about:networking in address bar
  • Go to "DNS" tab
  • Click "Clear DNS Cache"

Alternatively, type about:config, search for "network.dnsCacheExpiration", temporarily set value to 0, then revert after refresh.

Safari

No direct DNS flush option. You must:

  1. Disable Safari > Preferences > Advanced > "Show Develop menu"
  2. From menu bar: Develop > Empty Caches

This clears all caches, not just DNS. Overkill? Absolutely. But Apple gives no other choice.

Microsoft Edge

  • Go to edge://net-internals/#dns
  • Click "Clear host resolver cache"

Same as Chrome since they share Chromium base.

Warning: Browser cache clearing doesn't bypass OS-level DNS cache. Do both if problems persist.

Mobile Devices: Clearing DNS Cache on Android and iOS

Mobile OSes restrict direct cache access. Try these workarounds:

Android

  • Method 1: Enable Airplane mode for 30 seconds
  • Method 2: Change DNS to Google (8.8.8.8) or Cloudflare (1.1.1.1) in Wi-Fi settings
  • Method 3: Apps like "DNS Flusher" require root access (not recommended)

iPhone/iPad

  • Simplest fix: Toggle Airplane mode on/off
  • Alternative: Renew DHCP lease in Wi-Fi settings
  • Nuclear option: Reset network settings (erases all saved networks)

iOS is notoriously restrictive – I've had cellular carriers' DNS caches cause issues beyond user control. Rebooting usually helps.

Router DNS Cache: The Hidden Culprit

Did you know your home router caches DNS too? This causes whole-network issues:

  1. Access router admin page (usually 192.168.1.1 or 192.168.0.1)
  2. Look for "DNS" or "Network Settings"
  3. Find cache options – disable DNS caching if possible
  4. Restart router to flush cache

Some routers (like TP-Link) have explicit flush options. Others require reboots. If you're stuck, changing router DNS to Cloudflare or Google often bypasses ISP-level cache problems.

Troubleshooting: When Clearing DNS Cache Doesn't Work

Flushed cache but still having issues? Try these steps:

  • Verify cache cleared: On Windows, run ipconfig /displaydns – should show minimal entries
  • Browser isolation: Test in private/incognito mode
  • DNS checker tools: Use whatsmyDNS.com to see global DNS propagation
  • Hardware issues: Faulty Ethernet cables caused DNS timeouts for me last month

If problems persist after clearing DNS cache, consider malware scans. DNS hijacking malware redirects traffic even with clean caches.

FAQ: Your DNS Cache Questions Answered

Q: How often should I clear my DNS cache?

Only when experiencing issues. Modern systems manage cache well automatically. Power users might flush monthly.

Q: Does clearing DNS cache delete browser history?

No. Only IP-to-domain mappings. Your search history and cookies remain untouched.

Q: Why do I see "Access Denied" when trying to flush DNS?

You lack administrator privileges. On Windows/macOS/Linux, always run commands as admin/root.

Q: Can I disable DNS caching entirely?

Possible but not recommended. It'll make every website visit slower as your system queries DNS servers repeatedly.

Q: How long until DNS cache repopulates?

Instantly as you visit sites. But TTL (Time-To-Live) values determine how long records stay cached – usually hours to days.

Q: Does VPN affect DNS cache?

Absolutely. VPNs handle DNS requests through their servers. Clear cache before/after connecting for best results.

Preventive Measures and Pro Tips

  • Reduce cache duration: Windows Registry allows modifying DNS cache TTL (advanced users only)
  • Use public DNS: Services like Cloudflare (1.1.1.1) or Google DNS (8.8.8.8) update faster than ISP DNS
  • Script it: Create batch/shell scripts to flush DNS with one click
  • Browser extensions: "DNS Flusher" for Chrome automates browser-level cache clearing

Last month I set my dad's PC to automatically flush DNS weekly via Task Scheduler – no more "the internet is broken" calls.

Wrapping Up: When All Else Fails

Clearing DNS cache fixes most "phantom" connection issues, but not all. If problems continue:

  1. Check hosts file for manual overrides (C:\Windows\System32\drivers\etc\hosts)
  2. Update network drivers
  3. Test with different device on same network
  4. Contact your ISP – their DNS servers might be down

Remember: Learning how to clear DNS cache is networking 101. Bookmark this guide – you'll need it again. Trust me.

Leave a Comments

Recommended Article