DEV Community

upordown.online
upordown.online

Posted on

How to flush DNS cache on Windows 11, macOS, Linux, Chrome and Android

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_NXDOMAIN for a site that works elsewhere.
  • You edited the hosts file 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
Enter fullscreen mode Exit fullscreen mode

You should see: Successfully flushed the DNS Resolver Cache.

PowerShell also has a native cmdlet:

Clear-DnsClientCache
Enter fullscreen mode Exit fullscreen mode

To look at what's cached before or after:

ipconfig /displaydns
Get-DnsClientCache
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

macOS 10.10.0 to 10.10.3:

sudo discoveryutil mdnsflushcache
Enter fullscreen mode Exit fullscreen mode

macOS 10.7 to 10.9:

sudo killall -HUP mDNSResponder
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

systemd-resolved (Ubuntu 18.04+, Fedora, Debian with systemd-resolved, most desktops):

sudo resolvectl flush-caches
resolvectl statistics   # "Current Cache Size" should be 0
Enter fullscreen mode Exit fullscreen mode

On older systems the command is sudo systemd-resolve --flush-caches.

nscd:

sudo systemctl restart nscd
Enter fullscreen mode Exit fullscreen mode

dnsmasq:

sudo systemctl restart dnsmasq
Enter fullscreen mode Exit fullscreen mode

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:

  1. Open chrome://net-internals/#dns (Edge: edge://net-internals/#dns, Brave: brave://net-internals/#dns).
  2. Click Clear host cache.
  3. Open chrome://net-internals/#sockets and 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

  1. Open about:networking#dns.
  2. 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:

  1. Toggle Airplane mode on for 10 seconds, then off. This drops cached lookups for most apps.
  2. Chrome on Android: open chrome://net-internals/#dns in the address bar and tap Clear host cache.
  3. Still stuck: Settings → Apps → Chrome → Storage → Clear cache, or restart the phone.

iPhone and iPad

  1. Turn on Airplane Mode for 10–15 seconds, then turn it off.
  2. Or restart the device.
  3. 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
Enter fullscreen mode Exit fullscreen mode
# Windows
nslookup example.com
nslookup example.com 1.1.1.1
Enter fullscreen mode Exit fullscreen mode

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.1 also returns the old or missing address, the DNS records at the domain's provider need fixing, not your cache.
  • A hosts file entry. Entries in C:\Windows\System32\drivers\etc\hosts or /etc/hosts override 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 5xx errors 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)