How to flush your DNS cache

Make your computer forget old DNS answers after a site move or record change. Commands for Windows, macOS, Linux and every major browser.

2–3 minutes
Laptop screen showing code beside a keyboard

Your computer keeps a short-term memory of DNS answers so it does not have to ask again for every page. Right after a change, such as a site moving to a new server, that memory can keep sending you to the old place. Flushing the cache makes your computer ask again. It is safe and takes seconds.

Flushing only clears your computer. Your router and internet provider keep their own caches and let go when the record’s TTL runs out. If a change still has not reached you after flushing, waiting is usually the only fix. See DNS propagation.

Windows 10 and 11

  1. Open the Start menu, type cmd and open Command Prompt. Administrator rights are not needed.
  2. Run the command below. Windows replies Successfully flushed the DNS Resolver Cache.
ipconfig /flushdns

In PowerShell, the equivalent is Clear-DnsClientCache. To see what Windows has cached, run ipconfig /displaydns.

macOS

Open Terminal and run the line below. It asks for your password and prints nothing when it succeeds. It works on every release from El Capitan (10.11) onwards.

sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder

Linux

What to run depends on which service, if any, is caching.

systemd-resolved (Ubuntu, Debian 12 and newer, Fedora)

sudo resolvectl flush-caches
resolvectl statistics

Current Cache Size in the second command should read 0. On older releases the first command is sudo systemd-resolve --flush-caches.

dnsmasq or nscd

Neither has a flush command; restarting the service empties its cache:

sudo systemctl restart dnsmasq
sudo systemctl restart nscd

If none of these is running, your system is not caching DNS and there is nothing to flush. Many server installs, including AlmaLinux and Rocky Linux by default, are in this group.

Browsers keep their own cache

  • Chrome and Edge: open chrome://net-internals/#dns (or edge://net-internals/#dns) and press Clear host cache. Then open #sockets on the same page and press Flush socket pools.
  • Firefox: open about:networking#dns and press Clear DNS Cache.
  • Safari: uses the macOS cache, so the Terminal command covers it.

Check what the world sees

nslookup example.com 1.1.1.1
dig example.com @8.8.8.8 +short

If public resolvers show the new address and your machine does not, flushing is the fix. If they also show the old one, the change has not spread yet.

Something out of date? Software changes. If a step no longer works, tell us and we will check it and update the page.