Knowing how to flush DNS fixes a surprising number of “this site won’t load” problems. Flushing clears the list of saved domain-to-IP lookups so your device asks for fresh ones. Below are the exact commands for Windows 11 and 10, macOS, Linux and Chrome, plus what to do when the command fails.
What Flushing the DNS Cache Does
Every time you visit a site, your device stores the IP address it resolved to for a while. That DNS cache speeds up repeat visits, but it can hold on to an outdated or wrong address after a site moves servers, after you change DNS provider, or after you edit your hosts file.
When flushing DNS helps
Flush DNS when one site fails while others work, after a website migration, after changing DNS servers, after editing the hosts file, or when you see errors such as DNS_PROBE_FINISHED_NXDOMAIN. It is harmless: the cache simply rebuilds as you browse.
When it will not help
If every site fails, the problem is usually your connection, router or DNS server itself, not the local cache. Flushing will not fix a site that is actually down.
How to Flush DNS on Windows 11 and Windows 10
The same command works on Windows 11, 10, 8.1 and 7.
Flush DNS command in Command Prompt
- Press Start, type cmd, right-click Command Prompt and choose Run as administrator.
- Type
ipconfig /flushdnsand press Enter. - You should see Successfully flushed the DNS Resolver Cache.
To see what was cached before flushing, run ipconfig /displaydns.
Using PowerShell instead
In an elevated PowerShell or Windows Terminal window, run Clear-DnsClientCache. It does the same job and prints nothing when it succeeds.
If the command fails
An “access denied” style error means the window was not elevated. If you see Could not flush the DNS Resolver Cache: Function failed during execution, check that the DNS Client service is running in services.msc, then try again.
How to Flush DNS on Mac
Open Terminal and run:
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
Enter your Mac password when asked (nothing appears as you type). There is no confirmation message; a silent return to the prompt means it worked. This command applies to current macOS versions.
How to Flush DNS on Linux
Linux has no single DNS cache; it depends on what your distribution uses.
systemd-resolved (Ubuntu, Fedora and most modern distros)
Run sudo resolvectl flush-caches. On older systems the command is sudo systemd-resolve --flush-caches. Check with resolvectl statistics; the current cache size should drop to zero.
dnsmasq or nscd
If your system uses dnsmasq, restart it with sudo systemctl restart dnsmasq. For nscd, use sudo systemctl restart nscd. If none of these are installed, there may be no local cache to clear.
Flush DNS in Chrome and Other Browsers
Browsers keep their own cache on top of the operating system’s.
Google Chrome and Microsoft Edge
Go to chrome://net-internals/#dns (or edge://net-internals/#dns) and click Clear host cache. Then visit chrome://net-internals/#sockets and click Flush socket pools so open connections do not keep using the old address.
Firefox
Open about:networking#dns and click Clear DNS Cache. Restarting the browser also clears it.
Frequently Asked Questions
Is it safe to flush DNS?
Yes. It deletes only temporary lookup records. The first visit to each site afterwards may take a fraction of a second longer.
How often should I flush DNS?
Only when something is wrong or after a DNS or hosts change. There is no benefit to doing it on a schedule.
Can a tool flush DNS for me?
Yes. Some Windows utilities include a button for it; the portable Optimizer tool by hellzerg, for example, has a Flush DNS option next to its DNS switcher. The command above does exactly the same thing.
Conclusion
On Windows, ipconfig /flushdns in an elevated Command Prompt is all you need; Mac, Linux and browsers each have their own one-line equivalent. If flushing fixes the problem only temporarily, the cause is often your DNS server, so read our guide on how to change DNS in Windows 11. If you edited the hosts file, flush afterwards so the change takes effect.