How to Clear DNS Cache on Windows, macOS, and Linux
Sometimes your device stores outdated DNS information, which can cause website loading issues, incorrect IP resolution, SSL errors, or problems after DNS changes. Clearing the DNS cache forces your system to retrieve fresh DNS records.
- Website does not load after DNS changes
- Domain still points to an old IP address
- SSL or certificate mismatch errors appear
- Email or domain migration issues occur
- CDN or Cloudflare changes are not reflected
Clear DNS Cache on Windows
- Open Command Prompt as Administrator.
- Run the following command:
ipconfig /flushdns
Switch: /flushdns clears the local DNS resolver cache.
Expected result:
Successfully flushed the DNS Resolver Cache.
Optional Windows Commands
ipconfig /displaydns
Switch: /displaydns shows cached DNS records.
ipconfig /renew
Switch: /renew requests a new IP address from DHCP.
Clear DNS Cache on macOS
Open Terminal and run:
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
Switches:
-flushcacheclears the local DNS cache.-HUPsends a reload signal tomDNSResponder.
You may be asked to enter your administrator password.
Verify DNS Resolution on macOS
dig yourdomain.com
Command: dig performs a DNS lookup query.
Clear DNS Cache on Linux
Linux distributions may use different DNS caching services. Use the method that matches your system.
Systemd-Resolved
sudo resolvectl flush-caches
Command: flush-caches clears cached DNS entries.
Alternative command on some systems:
sudo systemd-resolve --flush-caches
Switch: --flush-caches clears cached DNS entries.
Check DNS cache statistics:
sudo resolvectl statistics
Command: statistics displays DNS cache information.
DNSMasq
sudo systemctl restart dnsmasq
Command: restart restarts the DNSMasq service and clears its cache.
nscd
sudo systemctl restart nscd
Command: restart restarts the Name Service Cache Daemon.
BIND / named
sudo rndc flush
Command: flush clears the BIND DNS cache.
Clear Browser DNS Cache
Google Chrome
chrome://net-internals/#dns
Open the address above in Chrome and click Clear host cache.
Microsoft Edge
edge://net-internals/#dns
Open the address above in Edge and click Clear host cache.
Restart Router DNS Cache
Some routers may also cache DNS records. Restarting the router can help clear cached DNS information.
- Restart the router.
- Wait 1–2 minutes.
- Reconnect to the network.
Test DNS Changes
Windows
nslookup yourdomain.com
Command: nslookup queries DNS records for a domain.
macOS / Linux
dig yourdomain.com
Command: dig performs a DNS lookup query.
host yourdomain.com
Command: host performs a simple DNS lookup.
- Restart your browser after clearing DNS cache.
- Temporarily disable VPN while testing DNS changes.
- Try another network connection.
- Restart your computer if the issue continues.
- DNS propagation may take up to 24–48 hours globally.