Locahl
Buy Locahl
DNSflush DNSclear DNS cacheWindowsmacOSLinuxChrome

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.

L

Locahl Team

Β·4 min read

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:
TEXT
ipconfig /flushdns
  • macOS (Tahoe, Sequoia, Sonoma, Ventura, Monterey, Big Sur) β€” Terminal:
BASH
sudo dscacheutil -flushcache && sudo killall -HUP mDNSResponder
  • Linux (systemd-resolved) β€” terminal:
BASH
sudo resolvectl flush-caches
  • Chrome / Edge (browser cache) β€” address bar:
TEXT
chrome://net-internals/#dns

Pick 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, Google 8.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_NXDOMAIN or 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:

BASH
sudo dscacheutil -flushcache && sudo killall -HUP mDNSResponder

Enter 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:

BASH
sudo resolvectl flush-caches

On 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:

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

Also readFlush DNS on Windows 10 & 11
Also readFlush DNS on Mac: macOS cache command
Also readFlush DNS on Linux
Share this article
Available on Windows, macOS & Linux

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
Buy Locahl β€” $11.99One-time payment, no subscription

Reader Reviews

4.7β˜…(3 reviews)
Martin L.
β˜…β˜…β˜…β˜…β˜…

"One page with the exact command for every OS. Bookmarked β€” I stop hunting for the Mac one every time."

June 20, 2026

Priya N.
β˜…β˜…β˜…β˜…β˜…

"Clear answer to "is it safe to flush DNS" plus the browser step everyone forgets. Fixed my stale local domain."

June 19, 2026

Jonas W.
β˜…β˜…β˜…β˜…β˜…

"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

10 min read
hosts fileWindowsmacOS

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.

L

Locahl Team

4 min read
hosts fileresetdefault

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.

L

Locahl Team

Developer tools team

4 min read
hosts filetroubleshootingDNS

/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.

L

Locahl Team

Developer tools team

2 min read
DNSLinuxflush DNS

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.

L

Locahl Team

Developer tools team