Flushing the DNS cache is one of those fixes you need twice a year and never remember. This page is a reference: the exact command for each system, how to confirm it worked, and when flushing is (and isn't) the right fix.
What the DNS cache is and why you'd flush it
Every time you visit a domain, your device asks a DNS resolver for its IP address and keeps the answer for a while (the record's TTL) so the next visit is faster. Several layers keep their own copy: the operating system, the browser, and often your router.
Flushing throws those copies away, so the next lookup asks fresh. That helps when:
- A site moved to a new server and you still land on the old one.
- You changed DNS records for your own domain and want to see the result.
- You get DNS errors such as
DNS_PROBE_FINISHED_NXDOMAINfor a site that works elsewhere. - You edited the
hostsfile and the change isn't picked up.
It does not help when the site itself is down. If a quick outside check (for example with a free checker like upordown.online) shows the site failing for everyone, flushing your cache won't change anything.
Windows 11 and Windows 10
Open Command Prompt or PowerShell (admin isn't strictly required for this command, but it avoids surprises) and run:
ipconfig /flushdns
You should see: Successfully flushed the DNS Resolver Cache.
PowerShell also has a native cmdlet:
Clear-DnsClientCache
To look at what's cached before or after:
ipconfig /displaydns
Get-DnsClientCache
The full list of ipconfig switches is in Microsoft's ipconfig documentation.
If flushing alone doesn't help, renew your lease and re-register too:
ipconfig /release
ipconfig /renew
ipconfig /registerdns
macOS
Open Terminal and run the command for your version. You'll be asked for your password; nothing is printed on success.
macOS 10.10.4 Yosemite and later (El Capitan through Sonoma, Sequoia and newer):
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
macOS 10.10.0 to 10.10.3:
sudo discoveryutil mdnsflushcache
macOS 10.7 to 10.9:
sudo killall -HUP mDNSResponder
On any modern Mac, the first command is the one you want.
Linux
Linux distributions don't all cache DNS the same way. Find out what you're running first:
resolvectl status 2>/dev/null | head -5 || cat /etc/resolv.conf
systemd-resolved (Ubuntu 18.04+, Fedora, Debian with systemd-resolved, most desktops):
sudo resolvectl flush-caches
resolvectl statistics # "Current Cache Size" should be 0
On older systems the command is sudo systemd-resolve --flush-caches.
nscd:
sudo systemctl restart nscd
dnsmasq:
sudo systemctl restart dnsmasq
No local cache: if /etc/resolv.conf points directly at your router or a public resolver and none of the services above are running, there's no OS-level cache to flush. Any caching happens in the browser or upstream.
Google Chrome, Edge, Brave and other Chromium browsers
Chromium browsers keep their own DNS cache, separate from the OS:
- Open
chrome://net-internals/#dns(Edge:edge://net-internals/#dns, Brave:brave://net-internals/#dns). - Click Clear host cache.
- Open
chrome://net-internals/#socketsand click Flush socket pools, so existing connections to the old address are closed.
If "Use secure DNS" is on (Settings → Privacy and security → Security), the browser resolves names itself over HTTPS, and this is the cache that matters most.
Firefox
- Open
about:networking#dns. - Click Clear DNS Cache.
If that page doesn't help, restarting Firefox fully also clears it.
Android
Android doesn't offer a "flush DNS" button, but these work:
- Toggle Airplane mode on for 10 seconds, then off. This drops cached lookups for most apps.
-
Chrome on Android: open
chrome://net-internals/#dnsin the address bar and tap Clear host cache. - Still stuck: Settings → Apps → Chrome → Storage → Clear cache, or restart the phone.
iPhone and iPad
- Turn on Airplane Mode for 10–15 seconds, then turn it off.
- Or restart the device.
- As a last resort: Settings → General → Transfer or Reset iPhone → Reset → Reset Network Settings (removes saved Wi-Fi passwords).
Your router
Many home routers also cache DNS. Rebooting the router clears it. If you've set a custom resolver on the router, that resolver's cache is outside your control, but it respects TTLs.
How to check that the flush worked
Compare what your system now resolves with what an authoritative public resolver says:
# macOS / Linux
dig +short example.com
dig +short example.com @1.1.1.1
# Windows
nslookup example.com
nslookup example.com 1.1.1.1
If both return the same addresses, your local cache is clean. If they differ, your configured resolver (router or ISP) is still holding an old answer. Wait for the TTL to expire or switch resolvers.
When flushing DNS won't fix it
If the error persists after clearing every layer above, the cause is probably elsewhere:
-
The record itself is wrong. If a public resolver like
1.1.1.1also returns the old or missing address, the DNS records at the domain's provider need fixing, not your cache. -
A
hostsfile entry. Entries inC:\Windows\System32\drivers\etc\hostsor/etc/hostsoverride DNS entirely, and flushing doesn't remove them. - A VPN or filtering DNS. VPN clients and ad-blocking DNS services answer lookups themselves. Disconnect them and test again.
-
It isn't DNS at all. Timeouts, refused connections and
5xxerrors happen after the name has resolved, so a flush can't help.
FAQ
Is it safe to flush the DNS cache?
Yes. It only removes temporary lookups. The next visit to each site takes a few extra milliseconds while the address is fetched again.
How often should I flush DNS?
Only when something is wrong. There's no benefit to doing it routinely.
Do I need admin rights to flush DNS?
On Windows, ipconfig /flushdns usually works without elevation. On macOS and Linux you need sudo.
Why can I still reach the old site after flushing?
Another layer still has it cached: the browser, the router, or your ISP's resolver. Clear the browser cache at chrome://net-internals/#dns, reboot the router, or test against a public resolver.
Does flushing DNS make the internet faster?
No. It can fix wrong or stale answers, but it doesn't speed anything up.
Top comments (0)