How to Flush DNS Cache in Windows, Linux, macOS, and Chrome
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.
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
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(orunbound-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:
- Open
chrome://net-internals/#dns(oredge://net-internals/#dns) in the address bar. - Click “Clear host cache”.
- 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.
