How to Clear DNS Cache on Mac, Windows, Linux & Chrome
In this article
Clearing the DNS cache forces your computer to re-query the domain name system (DNS) from scratch, which fixes issues like stale IP addresses, website errors, or pages that won't load after a server move. This guide covers the exact commands for macOS, Windows, Linux (including systemd-resolved and dnsmasq), and the Chrome browser. No third-party tools are needed, and you only need terminal or command prompt access.
What You'll Need
- Administrator or sudo access on your computer (for most commands).
- A terminal (macOS/Linux) or Command Prompt/PowerShell (Windows).
- For Chrome: the browser closed or at least a fresh tab to run the command.
Step-by-Step
macOS (all recent versions)
- Open Terminal (Finder > Applications > Utilities > Terminal).
- Type the following command and press Enter:
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder - Enter your admin password when prompted. You won't see characters as you type – that's normal.
- Wait a few seconds for the command to finish. No output means success.
Windows 10 / 11
- Press Win + R, type
cmd, then press Ctrl+Shift+Enter to run as Administrator. - Type
ipconfig /flushdnsand press Enter. - You should see the message: “Successfully flushed the DNS Resolver Cache.”
Linux – systemd-resolved (most modern distros like Ubuntu 18.04+)
- Open a terminal (Ctrl+Alt+T on Ubuntu).
- Run:
sudo systemd-resolve --flush-caches(older versions) orsudo resolvectl flush-caches(newer versions). - If neither works, try
sudo systemctl restart systemd-resolved.
Linux – dnsmasq (if you run a local DNS cache)
- Open a terminal.
- Restart the dnsmasq service:
sudo systemctl restart dnsmasq - If you’re running dnsmasq as a standalone process (not a service), find its PID with
pgrep dnsmasq, then runsudo kill -HUP <PID>to reload the cache.
Google Chrome (browser-specific cache)
- Open Chrome and type
chrome://net-internals/#dnsin the address bar. - Click the “Clear host cache” button on that page.
- Optionally, also go to
chrome://net-internals/#socketsand click “Flush socket pools” to clear connection pools.
Common Mistakes
- Forgetting sudo on macOS/Linux: Commands like
dscacheutilorkillallrequire root privileges; without sudo, you'll get “Operation not permitted.” - Using the wrong Linux command: Older Ubuntu used
sudo /etc/init.d/dns-clean start(deprecated). Stick to the systemd commands listed above. - Not running Windows Command Prompt as Administrator: A regular prompt will give “Access denied” or no output.
- Expecting immediate results: Some applications (like browsers) keep their own caches; you may need to restart them or clear Chrome's cache separately.
Tips
- After clearing, test with
ping google.comornslookup google.comto confirm DNS resolution works. - If you use a VPN or corporate proxy, the DNS cache may be on the remote server; your local flush won't affect that.
- For recurring issues, consider changing your DNS server to a public one (e.g., 8.8.8.8) – but that's optional.
- On macOS, you can also restart the network interface:
sudo ifconfig en0 down && sudo ifconfig en0 up(replace en0 with your active interface).
Troubleshooting
Command not found: If dscacheutil or resolvectl isn't recognized, your OS version may be older. On macOS 10.10 and earlier, use sudo dscacheutil -flushcache alone. On Linux, try sudo systemctl restart NetworkManager if you use NetworkManager.
No output on Windows: If you don't see the success message, run the command again as Administrator. Check that you're in the right shell (PowerShell also works, but the command is the same).
Website still won't load: The DNS cache isn't the only culprit. Try clearing your browser cache, restarting your router, or using a different device to isolate the issue.
dnsmasq won't restart: Check the config file for syntax errors with dnsmasq --test. If the service fails, run journalctl -u dnsmasq to see logs.
Frequently Asked Questions
Does clearing DNS cache speed up my internet?
Not directly. It only forces a fresh lookup; if the DNS server is slow, it might temporarily slow down the first request. It fixes errors, not speed.
How often should I clear DNS cache?
Only when you have issues like wrong IP addresses or after changing hosting providers. There's no need for regular maintenance.
Will clearing DNS log me out of websites?
No, it doesn't affect sessions or cookies. You'll stay logged in.
What's the difference between flushing DNS and clearing browser cache?
DNS cache stores IP addresses; browser cache stores files (images, HTML). They are separate; you may need to clear both for a stubborn site.
Can I clear DNS cache on my router?
Yes, but it's usually done by rebooting the router. Some routers have a “DNS” or “Status” page with a flush button.
Is it safe to clear DNS cache?
Yes, it's completely safe. It's a standard troubleshooting step and has no side effects beyond a one-time re-query.