keepcalculator

06 Numbers and Powers

Flush DNS Resolver Cache: How To & Why

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

Flushing the DNS resolver cache clears the temporary records your computer keeps of recent domain name lookups. You do this to fix issues like a website not loading, showing an old version, or returning a DNS error after a server move. The process takes seconds and varies by operating system, but the core command is ipconfig /flushdns on Windows and sudo dscacheutil -flushcache on macOS.

What the DNS Cache Actually Does

When you type a domain like example.com, your computer doesn’t know its numeric IP address (e.g., 93.184.216.34). It asks a DNS resolver, which may be your router, your ISP, or a public service like 8.8.8.8. That resolver looks up the address, sends it back, and your system stores the answer in a local cache. This speeds up subsequent visits because the next request skips the network round trip entirely.

The cache stores more than just the IP. It also keeps the time-to-live (TTL) value, which tells your system how long the record is considered valid. TTLs are set by the domain’s owner and can range from 30 seconds to days. Your OS respects the TTL, but some caches (like Chrome’s) may hold on longer. When a domain’s IP changes—say, a website migrates to a new server—your cached copy becomes stale. Flushing forces a fresh lookup.

Why You Might Need to Flush

Common triggers include:

  • Website not loading or timing out while other sites work fine.
  • Seeing an old version of a page after the owner changed hosting.
  • DNS errors like “ERR_NAME_NOT_RESOLVED” or “DNS_PROBE_FINISHED_NXDOMAIN” that persist after the site is confirmed up.
  • After changing your own DNS settings (e.g., switching to Cloudflare or Google DNS) so the new resolver’s answers aren’t mixed with old ones.
  • After editing your hosts file or your local network’s DNS records.

Flushing is a low-risk troubleshooting step. It doesn’t delete bookmarks, passwords, or browsing history. It only removes temporary name-resolution records. The worst that happens is the next few website visits feel slightly slower while the cache rebuilds.

How to Flush on Windows

  1. Open Command Prompt as administrator: press Win, type cmd, right-click “Command Prompt” and choose “Run as administrator.”
  2. Type ipconfig /flushdns and press Enter.
  3. You should see “Successfully flushed the DNS Resolver Cache.”

On older Windows versions (7, 8, 10), the same command works. Windows 11 also accepts ipconfig /flushdns in PowerShell or Terminal. If you get “Access denied,” you didn’t run as administrator.

For a full reset, you can also run ipconfig /registerdns to re-register your computer’s own DNS records and ipconfig /renew to refresh your IP lease, but those are separate actions.

How to Flush on macOS

macOS uses a different command depending on the version. Open Terminal (Finder > Applications > Utilities > Terminal) and run:

  • macOS Ventura (13) and later: sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
  • macOS Monterey (12) and earlier: sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder (same command, though some older guides omit the semicolon).

You’ll be prompted for your admin password. Terminal won’t show characters as you type—that’s normal. After pressing Enter, you may see no output, which means success. To verify, you can run dscacheutil -cachedump -entries Host and see that the host entries are empty or minimal.

How to Flush on Linux

Linux doesn’t have a universal DNS cache because it depends on the service you’re using. The three common ones are systemd-resolved, dnsmasq, and nscd.

  • systemd-resolved (most modern distros): sudo systemd-resolve --flush-caches (older) or sudo resolvectl flush-caches (newer).
  • dnsmasq: sudo systemctl restart dnsmasq
  • nscd: sudo systemctl restart nscd

If you’re not sure which one you have, run sudo systemctl status systemd-resolved to check. Many desktop distros use systemd-resolved by default, so resolvectl flush-caches is the safest bet.

Flushing the Browser Cache vs. DNS Cache

People often confuse the DNS cache with the browser cache. The browser cache stores actual page files (HTML, CSS, images) so that repeat visits load faster. The DNS cache only stores IP addresses. If a site looks broken or outdated, flushing the DNS cache won’t fix it—you need to clear the browser cache (Ctrl+Shift+Delete on Windows, Cmd+Shift+Delete on Mac) or use a private/incognito window.

However, browsers also maintain their own DNS cache. Chrome, for example, keeps a small cache separate from the OS. To clear Chrome’s DNS cache, you can type chrome://net-internals/#dns in the address bar and click “Clear host cache.” Firefox clears its DNS cache when you restart the browser or after the TTL expires. In practice, flushing the OS cache is usually enough because the browser will ask the OS for a fresh lookup.

Common Problems and Misconceptions

“Flushing didn’t fix my site.” That’s expected if the problem isn’t DNS. Check if the site loads on your phone using mobile data (which uses a different network path). If it does, the issue is likely your local network or device. Try restarting your router, which clears the router’s own DNS cache.

“I flushed but the old IP is still there.” Your OS may have more than one cache. Windows has a “DNS client” cache, but some apps (like Docker or virtual machines) maintain their own. Also, the domain’s TTL might be long, and your resolver (ISP) may still have the old record. Flushing your local cache doesn’t force your ISP’s resolver to refresh. You can check the current authoritative answer with a tool like nslookup or dig.

“Is flushing safe?” Yes. It’s a standard administrative task. It doesn’t affect your network settings, firewall rules, or any personal data. The only downside is a brief slowdown as the cache repopulates.

“Do I need to flush after changing my DNS server?” Not strictly, but it’s a good idea. If you switch from your ISP’s DNS to Google’s, your local cache may still have old IPs from the previous resolver. Flushing ensures all new lookups go to the new server.

Frequently Asked Questions

How often should I flush my DNS cache?
Only when you’re troubleshooting. There’s no maintenance benefit to flushing regularly; the cache is designed to speed up browsing. Frequent flushing just makes your browsing slower because every request needs a fresh lookup.

Will flushing DNS speed up my internet?
No, it won’t improve raw speed. It can fix a specific misconfiguration that causes timeouts, but after the cache rebuilds, performance returns to normal. If you’re experiencing general slowness, DNS is rarely the culprit.

Can I flush DNS on my router?
Yes, most routers have a “Reboot” option that clears their internal cache, or a “Status” page where you can “Release and Renew” the DNS lease. Rebooting the router is the easiest universal method.

Does flushing DNS clear my browsing history?
No. Browsing history, cookies, and saved passwords are stored by the browser, not the DNS cache. Flushing DNS only removes IP address records.

What if I’m on a corporate network?
Your company’s IT policy may restrict administrative commands. If you don’t have admin rights, you can’t flush the system cache. Contact your IT helpdesk instead. They may have a group policy that forces a cache refresh.

Why does my phone still show the old site after I flushed my PC?
Because your phone has its own DNS cache. On Android, you can toggle Airplane mode on and off to clear it. On iPhone, restarting the device or toggling Wi-Fi off/on usually works. You can also change your DNS server temporarily to force a refresh.

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 →