How to Flush DNS Cache: Windows, Mac, Linux, Browsers
How to Flush DNS Cache: Windows, Mac, Linux, Browsers
DNS caching speeds up the internet — the OS and browser remember resolver answers and skip repeated lookups. But when a site changes IP, NS migrate, or availability breaks, a stale cache becomes a problem: users keep hitting the old address. This guide covers step-by-step commands for every platform and browser.
When you need to flush the DNS cache
- A site's IP changed but your machine still goes to the old one.
- Hosting or NS migrated, TTL hasn't expired yet.
- Site fails with
DNS_PROBE_FINISHED_NXDOMAIN. - Malware hijacked DNS — after cleanup.
- Debugging: compare fresh answer with cached.
How DNS cache is layered
- Browser cache
- Chrome, Firefox, Safari — their own DNS cache, about 60 seconds.
- OS cache
- Windows DNS Client, systemd-resolved on Linux, mDNSResponder on macOS.
- Router cache
- Most home routers cache DNS for all devices.
- ISP / public resolver cache
- You can't control it — expires by TTL.
Windows (10, 11)
Open Command Prompt or PowerShell as Administrator:
ipconfig /flushdns
Successfully flushed the DNS Resolver Cache means it worked. View cache contents:
ipconfig /displaydns
Restart the DNS Client service:
net stop dnscache
net start dnscache
macOS
All versions from Monterey upward:
sudo dscacheutil -flushcache
sudo killall -HUP mDNSResponder
Ventura and Sonoma may also need:
sudo killall -HUP mDNSResponderHelper
Linux
Depends on your DNS service:
systemd-resolved (Ubuntu 18.04+, Debian 12+, Fedora)
sudo systemd-resolve --flush-caches
# or newer:
sudo resolvectl flush-caches
sudo resolvectl statistics
nscd
sudo systemctl restart nscd
# or
sudo /etc/init.d/nscd restart
dnsmasq
sudo systemctl restart dnsmasq
Browsers
Chrome / Edge / Opera (Chromium)
Open chrome://net-internals/#dns and click "Clear host cache". Also chrome://net-internals/#sockets and "Flush socket pools".
Firefox
Go to about:networking#dns and "Clear DNS Cache". Or disable internal DNS cache via about:config and network.dnsCacheEntries = 0.
Safari
Safari uses the system mDNSResponder — flush via macOS commands above.
Mobile
Android
Toggle Airplane mode — clears most of the cache. Or reboot the device. In Chrome: chrome://net-internals/#dns.
iOS
Airplane mode on/off clears Wi-Fi cache. Full reset: Settings, General, Reset, Reset Network Settings (also wipes saved Wi-Fi).
Routers
If flushing on all devices doesn't help, suspect the router. Open its web UI (usually 192.168.1.1 or 192.168.0.1) and:
- Reboot it.
- Change DNS settings to
1.1.1.1, 8.8.8.8. - Look for "Clear DNS cache" or "Reboot".
Verify the cache is flushed
Open DNS Lookup and compare with local dig:
dig A example.com +short # via system resolver
dig A example.com @1.1.1.1 +short # directly from public
If answers match and point to the current IP — cache is clean.
Why flushing sometimes doesn't help
- Stale ISP cache. Your OS asks the ISP resolver, which also caches. Switch to
1.1.1.1. - Change didn't land in the authoritative zone. Verify with
dig +trace. - HSTS preload. If the domain is on the preload list, SSL/TLS проверку is forced — the old connection may stick.
- Hosts file overrides. Check
/etc/hosts(Windows:C:\Windows\System32\drivers\etc\hosts).
FAQ
- Is flushing the DNS cache dangerous?
- No. Worst case: the first site load is slightly slower (50-200 ms).
- Do I need to reboot after flushdns?
- No, it takes effect immediately.
- Chrome doesn't open chrome://net-internals/#dns
- Newer Chrome moves the page to
chrome://net-export. Alternative: clear cache via Settings. - Does VPN affect DNS cache?
- VPNs typically override the DNS resolver. Disable the VPN and retest.
Conclusion
Flushing the DNS cache is the first step in any DNS debugging session. Learn the command for your OS, and whenever a stale cache is suspected, compare via DNS Lookup and Propagation Checker. If the issue recurs, set up DNS monitoring so you hear about changes before your users do.
Check your website right now
Check now →