[skipdns.dev]

How to Flush DNS on Windows, Mac, Linux & Chrome

Last updated · 4 min read

Your computer keeps a local copy of every DNS answer it looks up, so it doesn't have to ask again for every request. That's usually what you want, until you move a site to a new server or change a record. Then the cache keeps sending you to the old IP. Flushing the cache makes your machine ask again and get the current answer.

Below are the exact commands for each operating system and browser, how to confirm the flush worked, and the cases where flushing won't help at all.

Flush DNS on Windows

Open Command Prompt or PowerShell as a normal user (admin isn't required on current versions) and run:

ipconfig /flushdns

You should see Successfully flushed the DNS Resolver Cache. The PowerShell equivalent is:

Clear-DnsClientCache

To see what's in the cache before or after, use ipconfig /displaydns or, in PowerShell, Get-DnsClientCache. Piping it through a filter makes it readable:

Get-DnsClientCache | Where-Object Entry -like "*example.com*"

This works the same on Windows 10, Windows 11 and Windows Server.

Flush DNS on macOS

On every recent version of macOS (Big Sur through the current release), open Terminal and run:

sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder

Enter your password when asked. There's no success message; silence means it worked. The first command clears the directory service cache, and the second tells mDNSResponder, the process that actually resolves names on macOS, to drop its cache.

Flush DNS on Linux

Linux has no single DNS cache. Many systems don't cache at all, so first find out what's resolving names for you:

ls -l /etc/resolv.conf
resolvectl status 2>/dev/null | head -20

If /etc/resolv.conf points at 127.0.0.53 or links to stub-resolv.conf, you're on systemd-resolved (the default on Ubuntu, Debian 12+, Fedora and most desktop distros).

systemd-resolved

sudo resolvectl flush-caches
resolvectl statistics   # "Current Cache Size" should now be 0

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

nscd, dnsmasq and BIND

# nscd
sudo nscd -i hosts            # or: sudo systemctl restart nscd

# dnsmasq (common on routers and some desktops)
sudo systemctl restart dnsmasq

# BIND running as a local caching resolver
sudo rndc flush

If none of these are installed and resolv.conf points straight at your router or a public resolver, there's no local cache to flush. Any stale answer is coming from further upstream.

Clear the DNS cache in Chrome, Edge and Firefox

Browsers keep their own short-lived DNS cache on top of the operating system's, and they keep idle connections open to the old IP. After flushing the OS cache, clear the browser too.

Chrome (and Brave, Opera, other Chromium browsers)

  1. Go to chrome://net-internals/#dns and click Clear host cache.
  2. Go to chrome://net-internals/#sockets and click Flush socket pools. This closes connections that are still open to the old server.
  3. Reload the page with a hard refresh (Ctrl+Shift+R, or Cmd+Shift+R on a Mac).

Microsoft Edge

Same steps, different prefix: edge://net-internals/#dns → Clear host cache, then edge://net-internals/#sockets → Flush socket pools.

Firefox

Open about:networking#dns and click Clear DNS Cache. Restarting Firefox also clears it.

Secure DNS changes the picture. If the browser has "Use secure DNS" (Chrome/Edge) or DNS over HTTPS (Firefox) turned on, it sends lookups to its own provider and ignores your OS resolver and hosts file. Check the setting under Privacy and security if a flush seems to do nothing.

Check that the flush worked

Ask for the record directly and compare it with the IP you expect:

# Windows
nslookup example.com

# macOS / Linux
dig +short example.com
dig +short example.com @1.1.1.1    # what a public resolver sees right now

If your machine and @1.1.1.1 both return the new IP but the browser still shows the old site, the problem is in the browser cache or an open connection. If @1.1.1.1 still returns the old IP, the record hasn't expired upstream yet, and no amount of local flushing will change that.

When flushing DNS won't help

Flushing only clears caches on your own device. Three other layers can still serve the old answer:

For the full explanation of how long upstream caches hold on, see how long DNS propagation takes.

Testing a new server without touching DNS

A common reason to flush DNS is to check a site after moving it, or before switching the records at all. You don't need DNS to have changed for that. You can point a single request at the new IP:

curl -I --resolve example.com:443:203.0.113.10 https://example.com/

That's covered in detail in the curl --resolve guide. For checking in a real browser, or sending a link to a client, skipdns.dev is the fastest option. Enter the new server's IP and the domain and you get a temporary link that loads the site from the new server under its real hostname. There's no hosts file to edit, no cache to flush, and you can share the link with anyone. It's free and the link lasts 7 days.

If you're in the middle of a move, the website migration checklist covers the rest of the steps, including lowering TTLs ahead of time so the switch itself goes quickly.

FAQ

Does flushing DNS make propagation faster?

Only for your own machine. Flushing clears your local cache, but your ISP's or public resolver still holds the old answer until its TTL runs out. To see the new server before that, use curl --resolve, a hosts file entry, or a skipdns.dev preview link.

Is it safe to flush DNS?

Yes. The cache only holds copies of public DNS answers. After a flush, the next lookup for each domain takes a few extra milliseconds while the answer is fetched again. Nothing else changes.

How do I flush DNS on iPhone or Android?

Neither has a flush command. Toggling airplane mode on and off for a few seconds clears the system cache on both. On Android, if Chrome still shows the old site, clear its host cache at chrome://net-internals/#dns as well.

Why does my browser still show the old site after flushing?

Usually one of three things: the browser has its own cache (Chrome, Edge and Firefox all do), the browser uses Secure DNS (DNS over HTTPS) and skips the OS resolver, or the upstream resolver hasn't expired the old record yet. Clear the browser's host cache, close idle sockets, and check what dig @1.1.1.1 returns.

How often should I flush my DNS cache?

Only when you need to: after changing DNS records, after editing the hosts file, or when one site fails to load while others work. There's no maintenance benefit to flushing on a schedule.

← Preview a site before DNS changes with skipdns.dev