How to Flush Your DNS Cache (Windows, Mac & Linux)
Here are the exact commands to flush your DNS cache on Windows, macOS and Linux, why you would ever want to, and how to clear your browser's own DNS cache too.
If a website has just moved servers, you have switched DNS providers, or a page stubbornly refuses to load, learning how to flush your DNS cache is one of the fastest fixes in your toolkit. It takes one command, it is completely safe, and it makes your device throw away its stored shortcuts and look every address up fresh. This guide gives you the correct command for every platform, plus the browser step most people forget.
What the DNS cache is and why you'd flush it
Every time you visit a site, your device uses DNS to translate a name like example.com into a numeric IP address. Because that lookup happens constantly, your operating system keeps a small local cache of recent answers so it doesn't have to ask a DNS server over and over. Each entry has a time-to-live (TTL) after which it expires on its own.
Most of the time the cache is invisible and helpful. But it can hold on to a stale answer — for example, if a site's IP address changed but your cached entry still points at the old one. Flushing the cache forces a clean slate. Common reasons to do it include:
- A website moved to a new host and you are still landing on the old server.
- You just changed your DNS resolver (see our guide to changing your DNS server) and want the change to take effect immediately.
- You are troubleshooting a "DNS server not responding" error and want to rule out a bad cached record.
- A developer testing DNS changes wants to confirm the new records resolve correctly — you can double-check with our DNS Lookup tool.
Flushing the DNS cache never deletes files, bookmarks, passwords or settings. It only discards temporary lookup shortcuts. The worst that happens is the next visit to each site is a few milliseconds slower while the address is fetched again.
Flush the DNS cache on Windows
Windows uses a service called the DNS Client to manage its cache. Clearing it takes a single command.
- Press the Windows key, type
cmd, then right-click Command Prompt and choose Run as administrator. - Type the flush command and press Enter:
ipconfig /flushdns - You should see the message "Successfully flushed the DNS Resolver Cache."
Two related commands are handy while troubleshooting: ipconfig /displaydns prints the current cache contents so you can inspect them, and ipconfig /registerdns refreshes your DHCP lease and re-registers your name records. PowerShell users can also run Clear-DnsClientCache for the same effect as the flush.
Flush the DNS cache on macOS
On modern macOS the cache is handled by mDNSResponder, and the reliable approach is to clear the directory-services cache and then signal the responder to reload. Run both commands together in Terminal.
- Open Terminal (Applications → Utilities → Terminal).
- Enter the following, then type your administrator password when prompted:
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder - There is no success message — a silent return to the prompt means it worked.
This same two-part command has worked across many recent macOS releases. If you are on a much older version, the exact syntax varied, but the pair above is the safe modern default and does no harm.
Flush the DNS cache on Linux
Linux is a little different: many distributions historically did not cache DNS at the OS level at all. On modern systems running systemd-resolved (Ubuntu, Fedora and most current desktops), there is a cache, and you clear it like this:
- Open a terminal.
- Run the modern command:
sudo resolvectl flush-caches - On slightly older systemd versions, the equivalent is:
sudo systemd-resolve --flush-caches
If your machine uses a different resolver, the command differs: for dnsmasq restart the service with sudo systemctl restart dnsmasq, and for nscd run sudo nscd -i hosts or restart it. You can confirm which resolver is active by checking whether systemd-resolved is running.
Not sure a flush actually changed anything? Ask a DNS server directly with our DNS Lookup tool and compare its answer to what your browser loads. If they disagree, a cache somewhere is still holding an old record.
Flush your router's DNS cache
Your router may also cache DNS answers for the whole household. If flushing every device does not help, the router is the next suspect.
- Open your router's admin page in a browser (its address is the default gateway — see how to find your router's IP).
- Look for a Reboot or Restart option, or unplug the router for 30 seconds. A restart clears its DNS cache.
- Some routers also expose a dedicated Flush DNS or Clear cache button under their DNS or diagnostics settings.
Don't forget your browser's DNS cache
Web browsers keep their own DNS cache, separate from the operating system. This is the step people most often miss when a site still loads the wrong version after an OS flush.
| Browser | Where to clear its DNS cache |
|---|---|
| Chrome | Visit chrome://net-internals/#dns and click Clear host cache |
| Edge | Visit edge://net-internals/#dns and click Clear host cache |
| Brave | Visit brave://net-internals/#dns and clear the host cache |
| Firefox | Restart the browser, or set network.dnsCacheExpiration to 0 in about:config |
After clearing the browser's host cache, do a hard refresh of the page (Ctrl+F5 on Windows/Linux, Cmd+Shift+R on Mac) so the page content itself is fetched anew rather than served from the content cache.
Quick command reference
| Platform | Command |
|---|---|
| Windows | ipconfig /flushdns |
| macOS | sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder |
| Linux (systemd) | sudo resolvectl flush-caches |
| Linux (older systemd) | sudo systemd-resolve --flush-caches |
| Router | Reboot the router or use its Flush DNS option |
If flushing doesn't fix it
A flush cures stale-record problems, but it will not help if the real issue is elsewhere. If pages still fail to resolve, the next moves are to try a different DNS provider entirely, or to release and renew your IP address in case DHCP handed you bad settings. Our full checklist for a "DNS server not responding" error walks through the rest. And any time you want to confirm your connection is working end to end, a quick visit to IP Animals or a check with What's My IP tells you your address is resolving fine.
Frequently asked questions
Does flushing the DNS cache delete anything important?
No. The DNS cache only stores temporary copies of recent domain-to-IP lookups. Clearing it removes no personal files or settings. Your device simply asks a DNS server fresh the next time you visit each site, which takes a few extra milliseconds.
How often should I flush my DNS cache?
Almost never as routine maintenance. Flush it when a site has moved to a new server and you are still reaching the old one, after changing your DNS provider, or while troubleshooting a name-resolution error. The cache expires on its own otherwise.
Why does a site still load the old version after I flush DNS?
Two other caches can be involved: your browser keeps its own DNS cache, and it also caches the page content itself. Clear the browser's DNS cache and do a hard refresh. Recursive resolvers upstream also cache records until their TTL expires.
Do I need administrator rights to flush DNS?
On Windows you should run Command Prompt as administrator for reliability. On macOS and Linux the commands use sudo, so you will be asked for your password. Browser DNS caches can be cleared without any elevated rights.