How to Flush DNS Cache: The Definitive Guide [Windows, Mac, Linux & Mobile]

If a website fails to load, you’re seeing outdated content, or you’ve recently migrated a server, your computer is likely holding onto old location data. This is a DNS Cache issue.

While most guides simply list commands, modern networking is complex. Your Operating System (Windows/Mac/Linux) has a cache, but so does your browser (Chrome/Firefox) and your router. If you flush one but not the others, the problem persists.

This guide covers the full stack: OS-level commands, Linux service distinctions (systemd vs. dnsmasq), browser-internal flushing, and mobile troubleshooting.

Learn the difference also: System DNS vs Chrome DNS Cache

1. What is DNS Cache and Why Clear It?

The Domain Name System (DNS) is the internet’s phonebook. When you visit google.com, your computer asks a DNS Resolver for the IP address (e.g., 142.250.190.46). To save time, your device saves (caches) this answer locally.

Why Flush?

  • Stale records after a site migration: If a website moves to a new server, your cache might still point to the old IP, so the site fails to load or shows the outdated version. (A true HTTP 404 comes from the web server itself; flushing DNS fixes name-resolution problems, not missing pages.)
  • Security: Remove potential DNS spoofing records where hackers redirect traffic.
  • Privacy: Erase a localized history of visited domains.

The Technical Reality: Every DNS record has a TTL (Time to Live). Even if you flush your cache, you might still see old data if your ISP or Router is holding onto the record until the TTL expires.

What Flushing Fixes (and What It Does Not)

A flush only clears stored name records. It helps when the problem is a bad cached record:

  • A site moved servers and you still see the old site, or the browser says the server cannot be found.
  • DNS error codes such as DNS_PROBE_FINISHED_NXDOMAIN or ERR_NAME_NOT_RESOLVED in Chrome or Edge. Seeing the NXDOMAIN error specifically? It has its own full troubleshooting guide.
  • Suspected DNS spoofing, where a poisoned record redirects you to a fake site.
  • You just switched DNS providers (for example to 1.1.1.1) and want the new resolver used immediately.

Will flushing my DNS make my internet faster? No, and this is the most common misconception about the command. A flush forces your device to look everything up again, and fresh lookups are slower than cached ones. I measured this on my own machine: resolving a new domain took 36.7 ms the first time, while the repeat lookup answered from cache in 0.7 ms. Flushing throws away that head start. Treat it as a repair tool, not a tune-up.

Will flushing delete my browsing history, saved passwords, or logins? No. The DNS cache holds only domain-to-IP mappings. Your history, cookies, passwords, and sessions live elsewhere and are untouched by every command on this page.

Does flushing change which DNS server I use? No. It only empties the cache. Your configured resolver, whether that is your ISP, 1.1.1.1, or 8.8.8.8, stays exactly as it was. Changing the resolver is a separate step, covered in section 7.

2. Windows: Command Prompt & PowerShell Guide

Windows handles DNS caching via the DNS Client service. Whether you are on Windows 10, Windows 11, or Server editions, the command logic remains consistent.

Method A: Command Prompt (The Standard Way)

  1. Press Win + S and search for cmd.
  2. Crucial: Right-click “Command Prompt” and select Run as Administrator.
  3. Type the following command and press Enter:
ipconfig /flushdns

Success Message:
You should see: “Successfully flushed the DNS Resolver Cache.”

How to Flush DNS Cache: The Definitive Guide [Windows, Mac, Linux & Mobile]

Method B: PowerShell (For Power Users)

If you are scripting or prefer PowerShell:

  1. Right-click the Start button and select Windows Terminal (Admin) or PowerShell (Admin).
  2. Run this cmdlet:
Clear-DnsClientCache

Related but different: ipconfig /registerdns does not clear the cache. It re-registers your computer’s own name and IP address with the DNS server. On a home network you will rarely need it; on a domain-joined office PC it refreshes the records your company’s DNS holds for your machine.

Validation: Did it work?

To ensure the cache is gone, you can view the current cache before and after flushing:

ipconfig /displaydns

If the list is empty or significantly shorter, the flush was successful.

Run this check in the same Administrator window. A non-elevated Command Prompt can print a success message while silently leaving entries behind, which is the most common reason a flush appears to do nothing.

3. macOS: Commands by Version

Apple frequently updates how the mDNSResponder handles caching. Using the wrong command on a newer OS version often results in no action.

macOS Sonoma, Ventura, Monterey, & Big Sur (11.0+)

  1. Open Terminal (Cmd + Space, type “Terminal”).
  2. Copy and paste the following command:
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
  1. Enter your Mac’s login password when prompted.
    • Note: Terminal will not show characters as you type the password. This is a security feature; type your password, then press Enter. The same command works on macOS Sequoia (15) and later, since Apple has kept the mDNSResponder mechanism unchanged.

Legacy macOS (Catalina, Mojave, High Sierra)

For older Macs, the command syntax differs slightly:

sudo killall -HUP mDNSResponder

Pro Tip: You typically won’t see a “Success” message on macOS. To hear a confirmation audio cue, add ; say cache flushed to the end of the command.

4. Linux: Distinguishing Services (Not Just Distros)

Unlike Windows or Mac, Linux DNS flushing depends on the network manager service you are running, not just your OS version (Ubuntu/Fedora/Arch).

Check which service is actually running before you type anything: if none of systemd-resolved, nscd, or dnsmasq is active, your system probably keeps no local DNS cache at all, and there is nothing to flush.

Scenario A: systemd-resolved (Modern Standard)

Used by Ubuntu 22.04+, Debian 12, and Fedora.

  1. Check if you are using systemd-resolved:
    bash systemctl is-active systemd-resolved
  2. If active, run:
    bash sudo resolvectl flush-caches
  3. Verify:
    bash resolvectl statistics
    Look for “Current Cache Size: 0”.

Scenario B: nscd (Name Service Cache Daemon)

Common in Arch Linux or older RedHat systems.

sudo service nscd restart
# OR
sudo /etc/init.d/nscd restart

Scenario C: dnsmasq

Common in lightweight distros and server setups.

sudo systemctl restart dnsmasq

5. Alternative Methods: Browser-Level DNS (Chrome & Firefox)

This is the most common reason flushing fails. Modern browsers use “Secure DNS” (DNS-over-HTTPS), effectively bypassing your OS cache. You must clear the browser’s internal resolver.

Google Chrome / Microsoft Edge / Brave

These Chromium-based browsers share a similar net-internals structure.

  1. Open a new tab and type:
    chrome://net-internals/#dns
    (Replace chrome with edge or brave as needed).
  2. Click the button labeled Clear host cache.
Alternative Methods: Browser-Level flush DNS cache (Chrome & Firefox)

Mozilla Firefox

Firefox maintains its own memory cache independent of the OS.

  1. In the address bar, type: about:networking#dns
  2. Click the Clear DNS Cache button.

6. Mobile Devices: Android & iOS

Mobile OSs don’t provide a direct “Flush DNS” button, but you can force a refresh.

iOS (iPhone/iPad)

  1. Airplane Mode: Toggle Airplane Mode ON for 15 seconds, then OFF. This forces the radio to release network tables.
  2. Hard Reset (Nuclear Option): Go to Settings > General > Transfer or Reset iPhone > Reset > Reset Network Settings.

Android

  1. Chrome Flush: Use the chrome://net-internals/#dns method mentioned in Section 5 (works on mobile Chrome).
  2. Wi-Fi Toggle: Forget the Wi-Fi network and reconnect. Long press Wi-Fi icon > Tap the network > Forget. Re-enter password to connect.
  3. Private DNS (Android 9 and later): The Private DNS setting uses DNS-over-TLS and overrides everything above. Go to Settings > Network & internet > Private DNS. If it is set to a custom hostname, switch it to Off and test again; a misconfigured Private DNS hostname breaks resolution even with a perfectly clean cache.

7. Technical Validation & Troubleshooting

You ran the commands, but the site still won’t load? I flushed everything and the site still will not load. What now? Work through this order before changing anything drastic. Each step isolates a different layer.

  • Open a different website. If nothing loads at all, the problem is not DNS.
  • Try another device on the same Wi-Fi. If your phone loads the site, the issue is your computer, not the network.
  • Switch to mobile data. If the site loads there, your Wi-Fi path or your ISP’s resolver is the culprit.
  • Restart the browser. Browsers keep their own DNS cache (see section 5).
  • Reboot the router. This clears the network-wide cache when every device is affected.
  • Temporarily switch resolvers. Point the device at 1.1.1.1 or 8.8.8.8 to test whether your ISP’s DNS is at fault.
  • Wait out the TTL. If the site’s DNS just changed, resolvers worldwide honor the record’s TTL before fetching the new one. Check what the world sees with nslookup example.com 8.8.8.8, which bypasses your local cache entirely.

1. The Hosts File Check

Malware or old development settings might be hard-coding a domain to an IP.

  • Windows: check C:\Windows\System32\drivers\etc\hosts
  • Mac/Linux: check /etc/hosts
  • Ensure there are no lines mapping the problem domain to 127.0.0.1 or an old IP.

2. Router DNS Cache

Your router (Asus, Netgear, Linksys) caches DNS to speed up surfing for the whole house. This is part of its everyday job: see what a router actually does versus a modem.

  • Fix: Unplug your router power cable. Wait 30 seconds. Plug it back in. This clears the volatile memory.

3. Change DNS Resolver

If your ISP’s DNS is broken or caching aggressively, switch to a public provider.

  • Google DNS: 8.8.8.8 / 8.8.4.4
  • Cloudflare DNS: 1.1.1.1

4. Verification with Dig/Nslookup

Don’t guess; verify. Use the command line to ask exactly where the domain points right now.

nslookup example.com 8.8.8.8

This command forces a lookup against Google (bypassing local cache) to see if the global record matches what you see in your browser.


Summary Checklist

ComponentMethodDifficulty
Windows OSipconfig /flushdnsEasy
macOSsudo killall -HUP mDNSResponderMedium
Linuxresolvectl flush-cachesMedium
Chrome Browserchrome://net-internals/#dnsEasy
RouterPower Cycle (Reboot)Easy

Frequently asked questions

How often should I flush my DNS cache?

Only when you are troubleshooting a suspected DNS problem, such as a site stuck on an old server or a DNS error code. The cache manages itself; entries expire automatically when their TTL runs out, so there is no maintenance schedule to keep.

Is flushing the DNS cache safe? Can it break anything?

Yes, it is safe. Flushing only discards temporary lookup records, which your device rebuilds within seconds as you browse. There is nothing to back up and no setting gets changed.

Why does macOS show no confirmation after flushing?

Apple’s flush commands produce no success message by design. The absence of output (and the absence of an error) means it ran. Verify the fix by reloading the problem site rather than waiting for a message.

Do I need to flush the DNS cache on every device I own?

No, only on the device showing the problem. DNS caches are per-device. The exception is a network-wide issue affecting everything, in which case rebooting the router clears the shared cache in one step.

What is the difference between flushing DNS and changing DNS servers?

Flushing empties the cache of old answers; changing servers picks a different resolver to ask for new answers. They solve different problems: flush for stale records, switch servers when your current resolver is slow, broken, or hijacking results.

Disclaimer: Modifying network settings requires administrative privileges. Always ensure you have backups of critical configurations before resetting network adapters.

user profile reference
Kaleem
Computer, AI and Web Technology Specialist | Web | + posts

Kaleem is a Computer Science graduate (Virtual University of Pakistan) and the founder and editor of Valley AI, where he publishes in-depth, tested guides on computer hardware, artificial intelligence, and how the internet works. Every guide is researched from primary sources, tested hands-on where possible, and updated when the facts change.