keepcalculator

06 Numbers and Powers

Flush DNS Cache: Command for Windows, Mac, Linux

Card No. 06·66164 · Updated · Standard formula, shown below

To flush the DNS cache, you run a single command in your operating system’s terminal or command prompt: ipconfig /flushdns on Windows, sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder on macOS, and sudo systemd-resolve --flush-caches (or sudo resolvectl flush-caches) on most modern Linux distributions. This clears the local store of domain-to-IP mappings, forcing your computer to re-query DNS servers for fresh results.

What Is the DNS Cache and Why Flush It?

When you visit a website, your computer asks a DNS (Domain Name System) server to translate the human-readable domain (like example.com) into a numeric IP address. To speed up future visits, your operating system stores that answer locally in a cache. This cache is usually helpful, but it can become stale or corrupted, causing errors like “Website not found” or redirecting you to an outdated server. Flushing clears that local memory, so the next lookup goes straight to the DNS server for a fresh answer. It’s a common first step in troubleshooting network issues, after changing DNS servers, or when a website has moved to a new IP address and your computer still uses the old one.

How to Flush DNS on Windows

Windows uses the ipconfig utility. The steps are the same for Windows 10 and Windows 11.

  1. Open Command Prompt as Administrator: press Windows + X and select “Command Prompt (Admin)” or “Windows PowerShell (Admin)”. You can also search for “cmd”, right-click it, and choose “Run as administrator”.
  2. Type ipconfig /flushdns and press Enter.
  3. You should see the message: “Successfully flushed the DNS Resolver Cache.”

If you get an “Access denied” error, you didn’t run the command as administrator. Close the prompt and reopen it with admin rights.

How to Flush DNS on macOS

macOS uses the dscacheutil command combined with a restart of the mDNSResponder process. The exact command varies slightly by macOS version, but the following works on recent versions (macOS Ventura, Monterey, Big Sur, Catalina, and earlier).

  1. Open Terminal (found in Applications > Utilities).
  2. Type sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder and press Enter.
  3. Enter your administrator password when prompted (you won’t see characters as you type).

There is no confirmation message. If the command runs without an error, it worked. On older macOS versions (pre-10.10.4), you might need sudo killall -HUP mDNSResponder alone, or dscacheutil -flushcache for even older systems.

How to Flush DNS on Linux

Linux is more fragmented because different distributions use different DNS caching services. If you’re using systemd-resolved (common on Ubuntu, Debian, and Fedora), use:

sudo systemd-resolve --flush-caches

On newer versions, the command may be sudo resolvectl flush-caches. If you’re using the nscd service (older or CentOS/RHEL), use:

sudo service nscd restart

If you’re using dnsmasq, restart it with sudo systemctl restart dnsmasq. To check whether your system uses systemd-resolved, run sudo systemd-resolve --statistics – if it shows cache statistics, that’s your service. If not, you may not have a persistent DNS cache at all (many Linux setups don’t cache by default), and flushing is unnecessary.

What to Do If Flushing Doesn’t Fix the Problem

Flushing the DNS cache is a quick fix, but it doesn’t solve every network issue. If the problem persists, try these steps in order:

  • Renew your IP address: On Windows, run ipconfig /release then ipconfig /renew. On Mac/Linux, use sudo dhclient -r (release) and sudo dhclient (renew) if you use DHCP.
  • Clear the browser cache: Chrome, Firefox, and Edge each have their own internal DNS cache. Flushing the OS cache doesn’t clear these. Look in the browser’s settings or use a private/incognito window to test.
  • Check your DNS server settings: If you recently changed DNS servers (e.g., to Google’s 8.8.8.8), flushing ensures you’re using the new ones. Verify with ipconfig /all (Windows) or scutil --dns (Mac).
  • Restart your router: A router can also cache DNS. Power-cycle it to clear its memory.
  • Try a different device: If the issue only happens on one device, it’s local. If it happens on all devices, the problem is likely with your network or the website itself.

Common Misconceptions and Mistakes

One common mistake is using the wrong command for your operating system – for example, typing ipconfig /flushdns on a Mac. Another is forgetting to run the command as administrator on Windows, which results in an error. Some users also think flushing the DNS cache deletes their browsing history – it doesn’t. It only clears the IP address mappings, not cookies, history, or saved passwords. Another misconception is that you need to flush the DNS cache regularly for privacy. In reality, the cache is small and only stores the sites you visit; flushing it doesn’t hide your browsing activity from your ISP or the websites themselves. It’s only useful for troubleshooting or when you want to force a new DNS lookup.

Frequently Asked Questions

Does flushing DNS cache speed up my internet?

No, it usually slows it down temporarily. After flushing, your computer must re-query DNS servers for every domain it visits, which adds a few milliseconds to the first request. The cache exists to speed up repeated visits, so flushing removes that benefit. It’s only worth doing to fix a specific problem.

How often should I flush the DNS cache?

There’s no set schedule. Flush only when you’re troubleshooting a connection issue, after changing DNS servers, or when a website you visit frequently has moved to a new server and you’re getting errors. Doing it daily is unnecessary and provides no benefit.

Will flushing DNS cache clear my browser history?

No. The DNS cache is stored at the operating system level and contains only domain-to-IP mappings. Your browser history, cookies, and saved passwords are stored separately in the browser’s own profile. Flushing DNS has no effect on them.

What if I don’t have permission to run the command?

On Windows, you need to run Command Prompt as Administrator. On macOS and Linux, you need to use sudo and enter your password. If you don’t have admin rights on your computer, you can’t flush the DNS cache – you’ll need to contact your system administrator.

Is there a way to flush DNS without a command?

On Windows, you can restart your computer – the DNS cache is cleared on shutdown. On macOS, you can also restart. Some routers have a “Reboot” button that clears their cache. But the command-line methods are faster and more precise, especially if you only want to clear the OS cache without restarting.

Does flushing DNS work on mobile devices?

iOS and Android don’t expose a built-in command to flush the DNS cache. On iOS, turning Airplane Mode on and off or restarting the device clears the cache. On Android, you can toggle Wi-Fi off and on, or restart the phone. Some third-party apps claim to flush DNS, but they often just do the same toggle.

Related

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.

More cards in this drawer

The whole Numbers and Powers drawer →