How to Flush DNS Cache (Windows, Mac, Linux & Chrome)
How to flush or clear the DNS cache on Windows, Mac, Linux and Chrome. Copy the exact command for your system, learn what flushing DNS does and whether it is safe.
Locahl Team
Table of Contents
To flush the DNS cache, run the command for your system: ipconfig /flushdns on Windows, sudo dscacheutil -flushcache && sudo killall -HUP mDNSResponder on macOS, sudo resolvectl flush-caches on Linux, and chrome://net-internals/#dns β Clear host cache in Chrome. Flushing (also called "clearing") the DNS cache forces your computer to fetch fresh domain-to-IP records β the usual fix after editing the hosts file or changing DNS.
Quick answer: flush DNS command by system
- Windows 10 / 11 β Command Prompt or PowerShell:
ipconfig /flushdns- macOS (Tahoe, Sequoia, Sonoma, Ventura, Monterey, Big Sur) β Terminal:
sudo dscacheutil -flushcache && sudo killall -HUP mDNSResponder- Linux (systemd-resolved) β terminal:
sudo resolvectl flush-caches- Chrome / Edge (browser cache) β address bar:
chrome://net-internals/#dnsPick your platform below for the full walkthrough, verification command, and fixes when the change still does not apply.
What does flushing the DNS cache do?
Every device keeps a small table of recent domain lookups (for example example.com β 93.184.216.34) so it does not have to ask a DNS server every time. That table is the DNS cache. Flushing it deletes those stored records, so the next time you open a site your system resolves the name again from scratch β using your hosts file or DNS server, not an old answer.
You typically need to flush DNS when:
- You edited the hosts file but the browser still opens the old site.
- You switched DNS resolvers (Cloudflare
1.1.1.1, Google8.8.8.8, a VPN). - You moved a site to a new server and want to test before DNS propagates.
- You hit errors like
DNS_PROBE_FINISHED_NXDOMAINor a domain pointing to the wrong IP.
For the full picture of how lookups are ordered, see DNS resolution explained.
Is it safe to flush the DNS cache?
Yes. Flushing DNS only clears a temporary lookup table. It does not delete your history, cookies, saved passwords, or any files, and it does not log you out of websites. The cache simply rebuilds as you browse. The only side effect is that the very next lookups are marginally slower because they are not cached yet β unnoticeable in practice.
Flush DNS on Windows 10 and 11
1. Press the Windows key, type cmd (or PowerShell), right-click it, and choose Run as administrator. 2. Run ipconfig /flushdns. 3. Wait for "Successfully flushed the DNS Resolver Cache." 4. Verify with nslookup yourdomain.test or ipconfig /displaydns.
PowerShell has an equivalent cmdlet, Clear-DnsClientCache. Full details and WSL2 notes: flush DNS on Windows.
Flush DNS on macOS
Open Terminal and run:
sudo dscacheutil -flushcache && sudo killall -HUP mDNSResponderEnter your administrator password (nothing appears as you type). macOS prints no success message β returning to the prompt without an error means it worked. Older releases use a slightly different command; see the macOS flush DNS guide and, for the latest release, the macOS Tahoe guide.
Flush DNS on Linux
Most modern distributions use systemd-resolved:
sudo resolvectl flush-cachesOn older or different setups you may use sudo systemd-resolve --flush-caches, restart nscd, or restart dnsmasq. See flush DNS on Linux for every resolver.
Clear the DNS cache in your browser
Browsers keep a separate DNS cache, so a system flush alone may not be enough:
- Chrome / Edge: open
chrome://net-internals/#dns(oredge://net-internals/#dns) and click Clear host cache. On Mac, see the Chrome DNS cache guide; for Edge, see clear the DNS cache in Microsoft Edge. - Firefox: open
about:networking#dnsand click Clear DNS Cache.
Then reload the page in a fresh tab (old tabs can reuse a live connection).
Still resolving the old IP? Checklist
1. Flush the system DNS (command above for your OS). 2. Flush the browser DNS cache and open a new tab. 3. Confirm the hosts line is IP<space>hostname with no http:// or port. 4. Disable any VPN that forces its own DNS resolver. 5. Verify on the command line with nslookup, ping, or getent hosts yourdomain.test.
If the command line resolves correctly but the browser does not, the browser is the stale layer β clear it again.
If you switch local domains often, a hosts manager like Locahl edits the file safely and flushes DNS for you, so you avoid malformed lines and forgotten flushes entirely.
_Last tested: June 2026 on Windows 11, macOS 26 Tahoe and Ubuntu 24.04._
Sources and further reading
- How DNS works (Cloudflare Learning)
- ipconfig command reference (Microsoft Learn)
- The hosts file explained (Wikipedia)
Ready to simplify your workflow?
Stop wasting time with the terminal. Locahl lets you manage your hosts file in a few clicks, with automatic validation and no risk of errors.
- Intuitive visual interface
- Automatic DNS flush
- Multi-environment management
- Automatic backups
- JSON Import/Export
Reader Reviews
"One page with the exact command for every OS. Bookmarked β I stop hunting for the Mac one every time."
June 20, 2026
"Clear answer to "is it safe to flush DNS" plus the browser step everyone forgets. Fixed my stale local domain."
June 19, 2026
"Great overview. Linked deep-dives are handy when one command is not enough."
June 18, 2026
Frequently Asked Questions
What does flushing the DNS cache do?
It clears the locally stored domain-to-IP records so your system asks for fresh answers. After a hosts file edit or a DNS change, this is what makes the new address take effect.
Is it safe to flush the DNS cache?
Yes. Flushing DNS only deletes a temporary lookup table. It does not delete your browsing history, passwords or files. The cache rebuilds automatically as you browse.
What is the flush DNS command for each system?
Windows: ipconfig /flushdns. macOS: sudo dscacheutil -flushcache && sudo killall -HUP mDNSResponder. Linux (systemd): sudo resolvectl flush-caches. Chrome: chrome://net-internals/#dns then Clear host cache.
Why does my site still load the old IP after flushing DNS?
Your browser keeps its own DNS cache and may reuse an open connection. Clear the browser host cache too, and confirm the hosts file entry is correct.
How often should I flush the DNS cache?
Only when you need to. Flush after editing the hosts file, switching DNS servers, or testing a migration. Routine flushing is unnecessary and slightly slows the next lookups.
Related Articles
How to Edit the Host File (Windows, Mac & Linux)
Edit the host file on Windows, macOS and Linux: file location, admin rights, syntax, DNS flush, and troubleshooting when changes do not apply.
Locahl Team
How to Reset the Hosts File to Default (Windows, Mac, Linux)
Reset and restore the hosts file to its default contents on Windows, macOS and Linux. Copy the exact default file, back up first, then flush DNS so the reset takes effect.
Locahl Team
Developer tools team
/etc/hosts Not Working? Fixes for Windows, Mac & Linux
The hosts file is ignored or /etc/hosts changes do not take effect? Fix it on Windows, Mac and Linux: flush DNS, check syntax, IPv6, line endings, resolver caches and save permissions.
Locahl Team
Developer tools team
Flush DNS on Windows 10 & 11: ipconfig /flushdns (2026)
Flush the DNS cache on Windows 10 and 11 with ipconfig /flushdns. Step-by-step command, verification, and fixes when changes still do not apply.
Locahl Team
Developer tools team
Flush DNS on Linux: systemd-resolved & more (2026)
Flush the DNS cache on Linux with resolvectl flush-caches (systemd-resolved), plus nscd, dnsmasq and BIND. Commands by setup, with verification steps.
Locahl Team
Developer tools team