What the DNS cache is, and why flushing helps
Every time you visit a site, your computer has to translate its human-readable name — say example.com — into the numeric IP address the network actually routes to. That translation is done by DNS, the Domain Name System. Because looking a name up over the network takes time, your operating system keeps a local DNS cache: a small table of names it has recently resolved, paired with the addresses it got back. The next time you ask for the same name, the answer comes straight from that table instead of a fresh network round trip. If you want the full picture of what happens end to end, see how DNS works.
The catch is that cached answers can go stale. Each record carries a TTL (time to live) that tells your computer how long the answer may be trusted, but plenty can change inside that window. When a site migrates to a new host, a company switches CDNs, or you point a domain at a different server, your cache may still hold the old address and keep sending you to a server that no longer serves the page. Flushing the cache throws all of those stored answers away, forcing your machine to resolve every name again the next time it needs it.
The three everyday reasons to flush are:
- Stale records after a move or DNS change. You updated a DNS record, or a site you use moved hosts, and you are still landing on the old server.
- Troubleshooting. A domain will not load, resolves to the wrong place, or you are testing a new DNS provider and want a clean slate. Flushing removes cached state as a variable.
- Occasionally, privacy. The cache is a small record of the names your machine has looked up. Clearing it removes that local trace — though it does nothing about the copies held by your resolver or ISP.
Flush the DNS cache on Windows
Windows uses a single command that has been stable across Windows 7, 8, 10, and 11. Open Command Prompt or PowerShell (you do not need to run it as Administrator for this command) and run:
ipconfig /flushdnsYou should see Successfully flushed the DNS Resolver Cache. That clears the cache held by the DNS Client service. If you want to confirm the cache is empty afterward, you can run ipconfig /displaydns — it should return little or nothing until new lookups repopulate it.
Flush the DNS cache on macOS
On modern macOS (Monterey, Ventura, Sonoma, and Sequoia, and going back to El Capitan), flushing takes two commands run together, and you will be prompted for your password because both need administrator rights. Open Terminal and run:
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponderThe first command clears the Directory Service cache; the second signals mDNSResponder, the process that actually answers DNS queries on macOS, to reload with an empty cache. Running both is the reliable way to be sure the cache is gone — neither prints output on success, so no message is the expected result.
Flush the DNS cache on Linux
Linux has no single answer, because the caching is done by whatever resolver your distribution runs. Figure out which one you have and use the matching command below.
systemd-resolved (most modern distributions)
Ubuntu, Fedora, Debian, Arch, and most current desktop distributions use systemd-resolved. Flush it with:
sudo resolvectl flush-cachesOn older systemd versions, the equivalent command was:
sudo systemd-resolve --flush-cachesYou can confirm it worked by checking that the current cache size dropped with resolvectl statistics.
nscd (Name Service Cache Daemon)
If your system runs nscd instead, restart the service to clear its cache:
sudo systemctl restart nscddnsmasq
If a local dnsmasq instance is doing your caching — common on routers and some desktops — restart it:
sudo systemctl restart dnsmasqFlush your browser's DNS cache
Here is the part people miss: browsers keep their own DNS cache, entirely separate from the operating system. You can flush the OS cache and still get the old address because the browser answered from its internal copy. Chromium-based browsers (Chrome, Edge, Brave, Opera) expose a page for this. Type the following into the address bar:
chrome://net-internals/#dnsThen click Clear host cache. On Edge the address is edge://net-internals/#dns, and on Brave it is brave://net-internals/#dns — the button is the same. Firefox does not offer a dedicated page; the simplest reliable fix there is to close and reopen the browser, which discards its in-memory DNS cache. Because the browser cache is separate, a thorough flush usually means clearing both the OS cache and the browser cache.
Do not forget the router — and the TTL
Your home router almost certainly caches DNS lookups too, and it sits between every device on your network and the internet. If a record still looks stale after you have flushed your computer and browser, reboot the router: power it off, wait about thirty seconds, and power it back on. That clears its cache along with everything else.
Even then, one cache is outside your control. Your ISP's resolver — and any public resolver you use — holds each record for the length of its TTL, and it will keep serving the old answer until that timer expires, no matter what you flush locally. If a change still has not propagated after you have cleared everything on your side, the honest answer is usually to wait for the TTL to elapse. TTLs commonly range from a few minutes to a day. For a broader tour of resolvers and record types, see the DNS overview.
What flushing does not do
Flushing the DNS cache is a narrow tool, and it is easy to expect too much of it. It does not change your IP address — your public address comes from your ISP and is untouched by clearing name lookups. It does not clear cookies, browsing history, or your browser's file cache; those are separate. It will not fix a site that is genuinely down, a broken internet connection, or a misconfigured DNS record at the source. And it does not make you anonymous: your resolver still sees every domain you look up next. If privacy is the goal, encrypting your queries with DoH or DoT and confirming your setup with a DNS leak test will do far more than flushing a local cache ever could.
Frequently asked questions
Does flushing the DNS cache change my IP address?
No. Flushing clears only the record of the name lookups your computer has stored — the mapping of names like example.com to their IP addresses. It has no effect on your own public IP, which your ISP assigns, or on your local network address. To check your public address instead, start from the IPFerret home page.
How often should I flush my DNS cache?
Almost never as routine maintenance. The cache exists to make browsing faster, and every entry expires on its own once its TTL elapses. Flush it only when you are troubleshooting: a site moved hosts, you just changed DNS providers, or a domain resolves to an address you know is out of date.
I flushed my DNS cache but the site still points to the old server — why?
Because there is more than one cache between you and the authoritative name server, and you likely did not clear them all. Your browser caches separately from the operating system, your router caches lookups, and your ISP's resolver holds each record for its full TTL. Clear the browser cache, reboot the router, and if the record still looks stale, wait for the upstream TTL to expire.
Related reading
- How DNS works — the lookup chain the cache is built on, explained end to end.
- DNS overview — resolvers, record types, and why answers get cached in the first place.
- DoH vs. DoT — encrypting your DNS queries, and what each option actually protects.
- DNS leak test — confirm which resolver your queries are really going to.
- Glossary — plain-English definitions for TTL, resolver, and the rest of the DNS vocabulary.
