TECH / Windows 3 min read

How to Flush DNS Cache in Windows, Linux, macOS, and Chrome

Antonio NEMCD Author
Published Dec 2, 2009 · 3 min

After migrating a website to a new host, editing DNS records, or updating your hosts file, your computer may keep opening the old IP address for a while. That happens because both your operating system and browser cache recent DNS lookups locally.

Flushing DNS cache with ipconfig /flushdns in Windows

You do not have to wait for the record TTL to expire – clearing the local DNS cache on Windows, Linux, FreeBSD, macOS, and Chrome takes a single command.

Flush DNS Cache on Windows 10, 11, and Windows Server

Open Command Prompt (cmd) or Windows Terminal as Administrator and run:

ipconfig /flushdns

Watch the slash direction – it must be a forward slash /flushdns (a backslash \flushdns triggers a syntax error). You should see “Successfully flushed the DNS Resolver Cache.”

In PowerShell, the built-in cmdlet does the exact same thing:

Clear-DnsClientCache

To inspect what entries are currently stored in Windows’ DNS cache, run:

ipconfig /displaydns
If you see “Could not flush the DNS Resolver Cache: Function failed during execution”: the DNS Client service (Dnscache) is stopped. Press Win+R, run services.msc, locate “DNS Client”, and start it (though if you disabled it intentionally, Windows is not caching DNS locally anyway).

Flush DNS Cache on Linux and FreeBSD

Most modern Linux distributions (Ubuntu, Debian, Fedora, Arch) manage local DNS caching through systemd-resolved:

sudo resolvectl flush-caches

On older systems using systemd-resolve, run sudo systemd-resolve --flush-caches. If you run a local caching daemon instead:

  • BIND (named): sudo rndc flush
  • Unbound on FreeBSD: sudo service local_unbound restart (or unbound-control flush_zone .)
  • dnsmasq: sudo systemctl restart dnsmasq

Flush DNS Cache on macOS

On all current macOS releases (Catalina, Big Sur, Monterey, Ventura, Sonoma, Sequoia), run this single line in Terminal:

sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder

Enter your administrator password when prompted – the command produces no output on success.

Do Not Forget Browser DNS Cache (Chrome / Edge)

Even right after ipconfig /flushdns, Google Chrome, Microsoft Edge, and Brave keep their own internal DNS cache (especially with DNS-over-HTTPS enabled). To clear it too:

  1. Open chrome://net-internals/#dns (or edge://net-internals/#dns) in the address bar.
  2. Click “Clear host cache”.
  3. Open Sockets (chrome://net-internals/#sockets) and click “Flush socket pools”.

If the domain still resolves to the old IP after clearing both the OS and browser caches, your home router or ISP resolver is still holding the stale record – rebooting the router or switching temporarily to a public resolver like 1.1.1.1 or 8.8.8.8 usually clears it up right away.

Related posts:

Leave a Comment