Guides · DNS · Updated

What is DNS cache, and how do you flush it?

A DNS cache is a short-term memory of recent lookups, kept so your device doesn't repeat them. Flushing it clears that memory so the next visit asks DNS again. Do it when a site moved or a record changed and your device still goes to the old place.

See what the world sees first

Check whether the new value has reached public resolvers before you blame your cache:

Where DNS is cached

  1. The browser. Browsers keep their own short cache.
  2. The operating system. Windows, macOS and many Linux systems run a local resolver cache.
  3. The router. Many home routers cache answers for the devices behind them.
  4. Your provider's resolver, or a public one such as 1.1.1.1 or 8.8.8.8. This cache is shared by many users and lasts for the record's TTL.

Flushing the first three affects only you. The last one you can't flush yourself; you wait for the TTL to run out, as explained in how long DNS propagation takes.

Flush the cache on your device

Windows

ipconfig /flushdns
# or in PowerShell
Clear-DnsClientCache

View what is cached with ipconfig /displaydns.

macOS

sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder

Linux

# systemd-resolved
resolvectl flush-caches

# nscd
sudo nscd -i hosts

# dnsmasq
sudo systemctl restart dnsmasq

Which one applies depends on what your system runs. If resolvectl isn't found, you probably have no local cache to flush.

Browser

Close the browser completely and reopen it, or test in a private window. Chrome, Edge and Firefox also cache the page itself, so clear the site's cached files if the DNS is right but the page is old.

Router

Restart the router. It clears the cache and, if your provider changed something, picks up new settings.

Checking that it worked

Look the name up again from the command line (see DNS lookup commands) and compare it with the public resolvers above. If your device still returns the old value after a flush, the old value is coming from the resolver upstream, not from your machine.

Flushing doesn't speed up the internet and doesn't change anything for anyone else. Do it to see a change, not as routine maintenance.

Frequently asked questions

What does flushing the DNS cache do?

It deletes the answers your computer has remembered, so the next lookup asks the DNS server again. It does not change any DNS record and it does not clear your browsing history.

Is it safe to flush the DNS cache?

Yes. The cache refills on its own as you browse. The only effect is that the first visit to each site afterwards takes a few milliseconds longer.

Will flushing my cache make a DNS change appear faster?

Only on your own device. Resolvers elsewhere keep their copies until the TTL runs out, so other people may still see the old value.

Why do I still see the old site after flushing?

The browser, your router or your provider's resolver may hold the old answer. Restart the browser, try a private window, and compare with another resolver using the DNS propagation checker.