GUIDE

Flush the DNS cacheClear stale DNS on Windows, macOS and Linux

Flushing the DNS cache clears the locally stored name-to-address records so the next lookup is fresh. On Windows the command is ipconfig /flushdns. It helps when a site's IP address has changed and your machine is still using the old cached value, but it does not affect your router's or ISP resolver's cache, which expire on their own TTL.

BlackhawkHub Editorial · Updated

Why you would flush

Your computer caches DNS answers so it does not have to look up the same name repeatedly. Usually helpful, occasionally a problem: when a site changes its IP address, your machine may keep using the old cached value until it expires, sending you to the wrong (often decommissioned) server. Flushing the cache forces a fresh lookup. This is one piece of the wider DNS propagation picture.

Windows

cmd
ipconfig /flushdns
text
Windows IP Configuration
Successfully flushed the DNS Resolver Cache.

In PowerShell, Clear-DnsClientCache is the equivalent, and Get-DnsClientCache (or ipconfig /displaydns) shows the cache before you clear it. See ipconfig.

macOS

bash
sudo dscacheutil -flushcache
sudo killall -HUP mDNSResponder

Both commands together clear the cache and restart the responder. You will be prompted for your password.

Linux

It depends on the resolver:

bash
# systemd-resolved (most modern distributions)
sudo resolvectl flush-caches

# nscd
sudo systemctl restart nscd

# dnsmasq
sudo systemctl restart dnsmasq

Many Linux desktops cache through systemd-resolved; the first command covers them.

Browsers

Browsers keep their own DNS cache separate from the operating system. In Chrome and Edge, visit chrome://net-internals/#dns (or edge://net-internals/#dns) and click Clear host cache. Restarting the browser also clears it. Firefox uses the OS cache primarily.

What flushing does not do

  • Your router caches DNS and expires it on TTL; reboot it if you suspect it holds a stale record.
  • Your ISP's resolver (or a public resolver like 1.1.1.1) caches for the record's TTL; you cannot flush it, only wait.
  • The authoritative record itself: if the change has not been published there, no amount of flushing helps.

Checking whether it worked

After flushing, query the name directly and compare with a public resolver:

cmd
nslookup example.com
nslookup example.com 1.1.1.1

If your local result now matches the public one, the stale entry was local and flushing fixed it. If they still differ, the stale record is upstream. See nslookup and the DNS Lookup tool.

Frequently asked questions

How do I flush DNS on Windows?

Open Command Prompt or PowerShell and run ipconfig /flushdns. It reports "Successfully flushed the DNS Resolver Cache." No reboot is needed. In PowerShell, Clear-DnsClientCache does the same.

Does flushing DNS speed up propagation?

It only clears your own machine's cache. Your router and your ISP's resolver keep their own caches that expire on the record's TTL, and flushing yours does nothing to those. It helps when your local cache specifically holds a stale record.

When should I flush the DNS cache?

After a site or service changed its IP address (a migration, a new server) and your machine is still reaching the old one; after changing your DNS servers; or when troubleshooting name-resolution problems. If it does not help, the stale record is upstream, not local.

Sources