How to flush your DNS cache
When a site moved to a new server and you still land on the old one, or a page that works on your phone fails on your laptop, the stale answer is usually sitting in a DNS cache on the device in front of you. One command empties it.
In this guide
On Windows 11, open Terminal and run ipconfig /flushdns. On macOS, run sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder in Terminal. On Linux with systemd-resolved, run sudo resolvectl flush-caches. Chrome and Edge have their own cache at chrome://net-internals/#dns, and on a phone toggling Airplane mode does the job.
What flushing DNS actually does
DNS turns a name such as example.com into an address such as 203.0.113.42. Because the same names get looked up over and over, every layer between you and the internet remembers the answer for a while: your browser, your operating system, your router and the resolver your provider or a public service runs. Each cached answer carries a time-to-live (TTL), set by the domain's owner, after which it is thrown away and fetched fresh.
Flushing deletes the cached answers on your own device so that the next lookup goes out to the resolver again. It takes a fraction of a second, needs no reboot and deletes nothing else: no browsing history, no cookies, no saved passwords. The cases where it helps are specific: a website moved hosts and you still see the old server; a domain you just configured does not resolve; a typo or a crashed network earlier left a "name not found" answer cached (negative caching is real, and the usual reason a site "comes back" after a flush).
It does not help when the stale answer lives further along the chain. Your router and your resolver keep their own caches, and the only cure there is waiting out the TTL or, for the big public resolvers, asking them to purge. More on that at the end.
Windows 11: ipconfig /flushdns
- Right-click the Start button and choose Terminal. (Command Prompt or PowerShell works the same way.)
- Type
ipconfig /flushdnsand press Enter. - Windows replies Successfully flushed the DNS Resolver Cache. That is the whole job.
In PowerShell, Clear-DnsClientCache does exactly the same thing; Microsoft documents the two as equivalent. To see what is in the cache before or after, run ipconfig /displaydns, which lists every cached record with its remaining TTL in seconds, including entries loaded from the hosts file. The command works in an ordinary window; if you ever see an access error, reopen it as Terminal (Admin).
If the problem is a stuck network rather than a stuck name, the companion commands are ipconfig /release followed by ipconfig /renew, which hand the computer's IP address back to the router and ask for a fresh one. Those two do need an administrator window, and the connection drops for a second or two while they run.
macOS: one command for Tahoe, Sequoia and Sonoma
- Open Terminal (press Cmd + Space, type Terminal, press Return).
- Paste
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponderand press Return. - Type your Mac login password when asked. The cursor does not move while you type; that is normal. Press Return again.
The command produces no output when it succeeds. The second half is the one that matters on every macOS release since 10.15 Catalina: mDNSResponder is the process that resolves and caches names, and the HUP signal tells it to drop its cache and keep running. The first half clears the older Directory Services cache, which costs nothing and covers machines still on an old release, so the one-liner is safe to use everywhere.
Safari has no DNS cache of its own; it uses the system's, so the command above is all a Safari user needs. Chrome and Firefox on a Mac keep their own, covered below.
Linux: resolvectl, nscd, dnsmasq
Most desktop distributions released since 2020 (Ubuntu, Fedora, Debian 12, Arch) resolve names through systemd-resolved:
sudo resolvectl flush-cachesIt prints nothing on success. resolvectl statistics shows the current cache size, so you can confirm it dropped to zero. On older systems the same command was spelled sudo systemd-resolve --flush-caches.
If your machine runs a different caching service, restart it instead:
- nscd:
sudo systemctl restart nscd - dnsmasq:
sudo systemctl restart dnsmasq - BIND (named):
sudo rndc flush
Not sure which one you have? sudo lsof -i :53 lists whatever is listening on the DNS port. If nothing is, your Linux box has no system-level cache at all: every lookup already goes straight to the resolver in /etc/resolv.conf, and there is nothing to flush except the browser.
Chrome, Edge, Brave and Firefox keep their own cache
Chromium-based browsers cache DNS answers inside the browser, separately from the operating system, and a system flush does not touch them.
- Open a new tab and go to
chrome://net-internals/#dns(Edge:edge://net-internals/#dns; Brave:brave://net-internals/#dns). - Click Clear host cache. There is no confirmation message.
- If the site still behaves oddly, go to
chrome://net-internals/#socketsand click Flush socket pools, which closes the browser's open connections to the old server.
Firefox: open about:networking#dns and click Clear DNS Cache. Firefox's cache lives in memory only, so restarting the browser clears it too. The same net-internals page works in Chrome for Android, which is the only way to clear the browser's cache on a phone short of restarting it.
Android and iPhone
Neither mobile system exposes a flush command, but both drop their DNS cache when the network interface goes down and comes back.
- Open the quick settings panel (swipe down from the top) and turn Airplane mode on.
- Wait about ten seconds, then turn it off again. Wi-Fi and mobile data reconnect and start with an empty cache.
A restart does the same. On Android, Chrome's chrome://net-internals/#dns page clears the browser's own cache as well. On an iPhone the heavier option is Settings > General > Transfer or Reset iPhone > Reset > Reset Network Settings, which Apple notes also wipes saved Wi-Fi networks and passwords, cellular settings, and VPN and APN settings, so keep it for the day Airplane mode does not help. If you use an encrypted resolver through Private DNS on Android, switching it off and on again clears that cache too.
Check the answer after flushing
After a flush, the first visit to a site should get a fresh answer. To see what that answer is without opening the site, run the DNS lookup on the domain: it asks two independent resolvers and shows the A and AAAA records each one returns, with the TTL. If both agree with the new address but your browser still lands on the old server, the stale record is in the browser (clear it as above) or in the hosts file, which overrides DNS entirely: C:\Windows\System32\drivers\etc\hosts on Windows, /etc/hosts on macOS and Linux.
If the lookup itself still returns the old address, the cache is upstream. The What is my DNS server page shows which resolver answers your lookups. Rebooting the router clears its cache. The two largest public resolvers let anyone purge a domain: Google Public DNS flush and Cloudflare 1.1.1.1 purge both take a domain name and a record type. Your provider's resolver has no such button, and the only option there is to wait out the TTL or switch resolvers.
One last check: if you expected a VPN or an encrypted resolver to be answering and the lookup shows your ISP instead, run the DNS leak test. A cache does not cause that; a misrouted query does.
Test it now
CheckingRunning against our own test servers. Nothing is stored.
Open the DNS leak testQuestions
Is it good to flush DNS?
It is harmless and occasionally necessary. Flushing removes cached name-to-address answers, so the next lookup fetches a fresh one; nothing else on the computer changes. Do it when a site moved servers, a domain you just set up will not load, or an earlier failure left a "not found" answer cached. Flushing on a schedule gains nothing, since cached answers expire on their own.
How do I renew my IP and flush DNS at the same time?
On Windows, open Terminal as administrator and run the three commands in order: ipconfig /release, ipconfig /renew, ipconfig /flushdns. The first two return your address to the router and request a new one, which usually means the same address again on a home network. On macOS, turning Wi-Fi off and on renews the lease, then run the flush command.
Do I need to reboot after flushing DNS?
No. The flush takes effect the moment the command returns, and the next lookup already goes out to the resolver. A reboot is only useful as a blunt alternative on a phone, where there is no command to run. If a site still shows the old server after a flush, the stale answer is in the browser, the router or the resolver, and rebooting your computer will not reach those.
Does flushing DNS delete history or saved passwords?
No. The DNS cache holds only domain names and the addresses they resolved to, plus a timer. Browsing history, cookies, saved logins, downloads and bookmarks live in your browser profile and are untouched. The one thing a flush does reveal is nothing: ipconfig /displaydns lists the names your computer recently looked up, so the cache is a trace of activity, and flushing clears it.
How long does a DNS change take to show up everywhere?
As long as the record's TTL, set by whoever manages the domain. Common values are 300 seconds for busy services and 3,600 or 86,400 seconds for records that rarely change. Resolvers around the world keep the old answer until their copy expires, which is why "propagation" can look like a day even though the change itself was instant. Lower the TTL before a planned move.