DNS cache stores website IP addresses locally to speed up browsing. Sometimes it needs clearing when sites won't load or DNS changes.
Windows
Open Command Prompt (no admin needed) and run:
ipconfig /flushdns
Success message appears:
Successfully flushed the DNS Resolver Cache.
Done. DNS cache is cleared.
Mac
macOS Big Sur (11) and later:
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
macOS Catalina (10.15):
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
macOS Mojave (10.14) and earlier:
sudo killall -HUP mDNSResponder
Enter Mac password when prompted. No success message appears, but cache is flushed.
Linux
Ubuntu/Debian (systemd-resolved):
sudo systemd-resolve --flush-caches
Verify it worked:
sudo systemd-resolve --statistics
Look for "Current Cache Size: 0"
Using nscd:
sudo /etc/init.d/nscd restart
Using dnsmasq:
sudo /etc/init.d/dnsmasq restart
When to Flush DNS Cache
Websites won't load but internet works: DNS cache might have outdated or corrupt entries.
After changing DNS servers: Old cached results need clearing to use new DNS.
Domain recently changed IP: Cache still has old IP address.
Testing DNS changes: Verify updates propagated correctly.
Privacy/security: Clear browsing history at DNS level.
Browser DNS Cache
Browsers have separate DNS cache. Flush it too:
Chrome: Visit: chrome://net-internals/#dns Click "Clear host cache"
Firefox: Restart browser or visit about:networking#dns Click "Clear DNS Cache"
Edge: Visit: edge://net-internals/#dns Click "Clear host cache"
Verify DNS Flush Worked
Windows:
ipconfig /displaydns
Shows current DNS cache. Should be mostly empty after flush.
Test resolution:
nslookup google.com
Forces fresh DNS lookup.
Common Issues
"Access denied" on Windows: Open Command Prompt as Administrator (right-click > Run as administrator).
Mac command doesn't work: Check macOS version, use correct command for your version.
Linux - service not found: Your system might not use that DNS service. Try different command or check which DNS service is running.
Clear DNS and Reset Network
Windows - full network reset:
ipconfig /flushdns
ipconfig /release
ipconfig /renew
Flushes DNS, releases IP, gets new IP from router.
Mac:
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
networksetup -setairportpower en0 off
networksetup -setairportpower en0 on
Flushes DNS and restarts WiFi.
Bottom Line
Quick DNS flush commands:
Windows: ipconfig /flushdns Mac: sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder Linux: sudo systemd-resolve --flush-caches
Also clear browser DNS cache for complete flush. Test with nslookup to verify.
Most common fix for "site won't load but internet works" problems.