Skip to content

How to Clear DNS Cache: Mac, Chrome, Windows, Linux, dnsmasq

Updated 6 min read

Updated: 11 October 2026 · Applies to: dnsmasq 2.91 (Debian 13) and systemd-resolved (systemd 259 on Ubuntu 26.04, 255 on 24.04), tested; macOS, Windows 10 and 11, Google Chrome and Google Public DNS from the vendors’ documentation

To clear the DNS cache, run the command for the system that keeps the old answer:

  • Mac: sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
  • Windows: ipconfig /flushdns
  • Linux with systemd-resolved (Ubuntu): sudo resolvectl flush-caches
  • dnsmasq: sudo systemctl restart dnsmasq (or send it a HUP signal)
  • Chrome: open chrome://net-internals/#dns and click Clear host cache
  • Google Public DNS: use Google’s Flush Cache page for the domain

Flushing only clears the copy on that one device or resolver. Other computers, your internet provider and public resolvers keep their copies until the record’s TTL runs out, which is why a moved website can still open the old server for some visitors.

Clear the DNS cache on a Mac

  1. Open Terminal: according to Apple, search for Terminal in Spotlight, or open it from the /Applications/Utilities folder in the Finder.
  2. Run this line and type your Mac password when asked:
    sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
  3. Reload the website (in Chrome, also clear its own cache as shown below).

The second part does the real work. Apple’s support article on resetting the DNS cache (now archived) gives sudo killall -HUP mDNSResponder for OS X 10.10.4 and later, and Apple’s published mDNSResponder source logs SIGHUP: Purge cache when it receives that signal. The first part, dscacheutil -flushcache, is the command the same article gives for Mac OS X 10.6; most people run both, as in the line above.

Clear the DNS cache in Chrome

Chrome keeps its own host cache, so a website can stay on the old address in Chrome even after you flush the operating system.

  1. Type chrome://net-internals/#dns in the address bar and press Enter.
  2. Click Clear host cache. Google’s Chromebook help gives these same two steps for a page that will not open.
  3. Optional: open chrome://net-internals/#sockets and click Flush socket pools. This closes connections Chrome already has open, so the next request connects again instead of reusing a connection to the old server.
  4. Reload the page.

If Use secure DNS is on with a custom provider (Settings, Privacy and security, Security), Chrome asks that provider rather than your system resolver. Flushing your computer’s cache then makes no difference to Chrome; clear the host cache as above. For cached pages, images and cookies, see how to clear your browser cache.

Flush Google Public DNS (8.8.8.8)

If your computer uses Google Public DNS and it still returns the old record, you can ask Google to drop it:

  1. Open Google’s Flush Cache page.
  2. Enter the Domain Name and choose the RR Type (record type, A by default).
  3. Click Flush Cache and solve the reCAPTCHA.

Points from Google’s FAQ: you do not need to own the domain; if the registrar or DNS hosting changed recently, flush the main domain before its subdomains; for a stale CNAME, flush each name in the chain starting from the last one; domains that use EDNS Client Subnet cannot be flushed. Without a manual flush, Google says cached records are generally kept for no more than six hours, even when the TTL is longer. Cloudflare’s 1.1.1.1 resolver has a similar Purge Cache tool, described in its FAQ.

Windows

Open Command Prompt or PowerShell and run:

ipconfig /flushdns

In PowerShell, Microsoft documents Clear-DnsClientCache as equivalent. ipconfig /displaydns shows what is cached. According to Microsoft, that cache also holds entries loaded from the local hosts file; a hosts file entry comes back after a flush, so remove it from the file instead.

Linux: find out which cache you have

systemctl is-active systemd-resolved dnsmasq nscd

Use the section for each service that shows active. If none is active, there is no local DNS cache to clear: lookups go straight to the servers in /etc/resolv.conf. That is the normal setup on AlmaLinux and Rocky Linux servers (AlmaLinux 10 does not even package nscd any more).

systemd-resolved (Ubuntu and many desktops)

sudo resolvectl flush-caches
resolvectl statistics

Lab example from an Ubuntu 26.04 container: after two lookups of example.com, the second answer said Data from: cache and the statistics showed Current Cache Size: 2. After sudo resolvectl flush-caches:

Cache
                         Current Cache Size: 0
                                 Cache Hits: 2
                               Cache Misses: 2

resolvectl show-cache lists the cached records themselves (it worked on Ubuntu 24.04 and 26.04). The old command systemd-resolve --flush-caches no longer exists on either version: the result is command not found.

dnsmasq

dnsmasq keeps its cache in memory. According to its manual, a HUP signal clears the cache and re-reads /etc/hosts, but not the configuration file. Either of these works:

sudo systemctl restart dnsmasq      # also loads a changed dnsmasq.conf
sudo pkill -HUP dnsmasq             # clears the cache, keeps running

On Debian and Ubuntu, sudo systemctl reload dnsmasq does the same as the HUP (the unit’s reload action is kill -HUP). The AlmaLinux 10 unit (dnsmasq 2.90) has no reload action, so use restart there.

Lab example with dnsmasq 2.91 on Debian 13. Its upstream server changed the answer from 203.0.113.10 to 203.0.113.20, but dnsmasq kept serving the cached address until it got the signal:

$ dig @127.0.0.1 www.example.com +noall +answer
www.example.com.	293	IN	A	203.0.113.10
$ dig +short @127.0.0.1 www.example.com
203.0.113.10
# HUP signal sent to the caching dnsmasq process
$ dig +short @127.0.0.1 www.example.com
203.0.113.20

The dnsmasq log then shows cleared cache. To see cache statistics without the log, query dnsmasq itself (default cache size: 150 names):

dig +short chaos txt cachesize.bind @127.0.0.1
dig +short chaos txt hits.bind @127.0.0.1

If NetworkManager runs dnsmasq for you (dns=dnsmasq in NetworkManager.conf), restart that instance with sudo nmcli general reload dns-full. nmcli describes this flag as restarting the DNS plugin, which briefly interrupts name resolution.

nscd

If nscd is active (still packaged on Debian 13 and Ubuntu 24.04), clear its hosts table with sudo nscd -i hosts.

Check what the internet sees

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

If the public resolvers already return the new address and only your device does not, flush your local cache. If they still return the old address, the change has not reached them yet (wait for the TTL, or use the flush tools above) or your DNS provider still serves the old record. More lookup options: dig, nslookup and host. To use different DNS servers altogether, see how to change your DNS servers, and to preview a site on a new server before DNS changes, see test your website before changing DNS.

Official documentation: Google Public DNS FAQ, ipconfig and dnsmasq manual.

Related services

KVM VPS hosting

NVMe SSD and full root access, with Free Basic Managed Support.

Unmanaged dedicated servers

full root access and free IPMI KVM, with Free Basic Managed Support.

Linux server management

hardening, patching, monitoring and automation for Ubuntu, Debian, RHEL and AlmaLinux.

Was this answer helpful?

Still stuck? Open a ticket