Updated June 2026

How to Flush DNS Cache on Any Device

Step-by-step instructions for clearing the local DNS resolver cache on Windows, macOS, Linux, and web browsers. Takes under a minute.

What Is DNS Cache

Every time your computer visits a website, it performs a DNS lookup. It translates the domain name you type — like example.com — into the numerical IP address where the site actually lives. That lookup involves querying your DNS resolver, which may talk to several authoritative servers before returning the answer.

The first time you visit a site, that lookup can take anywhere from 15 to several hundred milliseconds depending on your resolver and your connection. To avoid repeating that process every single time you load a page, your operating system stores the result locally. That stored result is the DNS cache.

The cache lives at two levels. Your operating system maintains its own cache, accessible by all applications on the machine. Individual browsers — Chrome, Firefox, Edge, Safari — also maintain separate internal caches. When you type a URL, your browser first checks its own cache. If the answer is not there, it asks the OS. If the OS does not have it either, it goes out to your configured DNS resolver.

DNS entries in the cache are not permanent. Each record comes with a TTL — time to live — set by the domain owner. Common TTL values range from 300 seconds (5 minutes) to 86400 seconds (24 hours). When the TTL expires, the entry is removed and the next lookup requires a fresh query to the resolver.

The cache is a performance optimization. Without it, every single page load would require dozens of redundant DNS lookups, making the internet feel noticeably slower. The problem arises when the cache holds outdated or incorrect information.

When to Flush DNS Cache

Flushing the DNS cache forces your system to discard all stored DNS records and re-fetch them on the next lookup. Here are the most common reasons you need to do it.

You changed your DNS server

If you just switched to a faster resolver like Cloudflare 1.1.1.1 or Quad9, your system may still be using cached responses from your old resolver. Flush the cache so every new lookup goes through the new server.

A website moved to a new server

When a website changes its IP address — whether due to a hosting migration, CDN change, or DNS update — your cache may still point to the old address. You will see errors like "This site can't be reached" or the site loads outdated content. Flushing forces a fresh lookup that returns the current IP.

DNS changes are not taking effect

After you update DNS records for your own domain, changes can take up to 48 hours to propagate worldwide. But locally, your own system may be holding on to the old records. Flushing the cache removes that local obstacle so you can verify the changes immediately.

Connection errors and website not loading

Some connection errors — especially "DNS_PROBE_FINISHED_NXDOMAIN" or "Server not found" — are caused by a corrupted cache entry. If a website was working fine earlier but suddenly stops loading while other sites work normally, a corrupted DNS cache is a likely cause. Flushing it resolves the problem in most cases.

Security concerns

In rare cases, DNS cache poisoning attacks can inject fraudulent entries into your local cache, redirecting you to malicious sites. Flushing the cache removes any tampered records.

How to Flush DNS Cache on Windows

Windows maintains a local DNS resolver cache managed by the DNS Client service. The command to clear it is a single line.

Windows 10 and 11

  1. Open the Start menu and type cmd.
  2. Right-click Command Prompt and select Run as administrator. If User Account Control prompts you, click Yes.
  3. Run the following command:
    ipconfig /flushdns
  4. You will see the message: "Successfully flushed the DNS Resolver Cache."

That is it. The cache is cleared. The next time any application on your system needs to resolve a domain name, it will query the DNS resolver fresh instead of using a cached answer.

Viewing the cache

If you want to see what is in the cache before clearing it, run:

ipconfig /displaydns

This dumps every cached entry to the console. You will see domain names, their IP addresses, and the remaining TTL for each record.

PowerShell alternative

You can also flush the DNS cache from PowerShell as administrator:

Clear-DnsClientCache

This does the same thing as ipconfig /flushdns. Use whichever method you are comfortable with.

Important notes for Windows

You must run the command in an elevated (administrator) terminal. Running it without admin privileges will silently fail — the command will appear to succeed but the cache will not actually be cleared. If you are unsure whether you have admin rights, always right-click and choose "Run as administrator."

Windows does not require a restart after flushing the DNS cache. The change takes effect immediately for all applications on the system.

How to Flush DNS Cache on macOS

macOS uses the mDNSResponder daemon to manage DNS resolution and caching. The exact command to flush the cache has changed across macOS versions, but a single universal command works on all modern versions.

macOS Sonoma, Ventura, Monterey, Big Sur, Catalina

  1. Open Terminal. You can find it in Applications → Utilities, or search for it with Spotlight.
  2. Run the following command:
    sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
  3. Enter your administrator password when prompted. The cursor will not move as you type — this is normal for sudo prompts on macOS.
  4. The command completes silently with no output. This is expected. The cache is cleared.

The command combines two operations: flushing the directory service cache and signaling mDNSResponder to restart. Running both ensures all DNS cache layers are cleared regardless of which macOS version you are on.

What about older macOS versions?

The universal command above works across all versions from 10.7 (Lion) through the latest macOS 15. Older guides reference version-specific commands like sudo dscacheutil -flushcache for 10.7-10.9 or sudo discoveryutil mdnsflushcache for 10.10-10.11. The universal command covers all of these.

Verifying the flush

To confirm the DNS cache was cleared, you can run:

sudo killall -INFO mDNSResponder

This signals mDNSResponder to log its current state to the system log. Open Console.app and filter for "mDNSResponder" to see cache statistics.

Important notes for macOS

You do not need to restart your Mac or restart any browsers after flushing the DNS cache. The change is immediate. However, if you are troubleshooting a specific site, close and reopen the browser tab to ensure the browser's internal cache is also bypassed on the next request.

How to Flush DNS Cache on Linux

Linux does not have a single universal DNS caching mechanism. The method depends on which DNS resolver your distribution uses. Most modern Linux distributions use one of three systems.

systemd-resolved (Ubuntu 18.04+, Fedora, Arch, most modern distros)

Most current Linux distributions use systemd-resolved as the default DNS resolver. To check if you are using it:

resolvectl status

If this command works and shows a "DNS Servers" section, you are using systemd-resolved. To flush the cache:

sudo systemd-resolve --flush-caches

Or using the shorter resolvectl command:

sudo resolvectl flush-caches

To verify the cache was cleared:

resolvectl statistics

Look at the "Current Cache Size" field. It should show 0 after flushing.

nscd (Name Service Cache Daemon)

Some distributions run nscd to cache DNS lookups. If your system uses nscd, restart the service to clear its cache:

sudo /etc/init.d/nscd restart

On systemd-based distributions, you can also use:

sudo systemctl restart nscd

If nscd is not installed on your system, this command will fail. That is fine — it means nscd is not caching DNS for you.

dnsmasq

If your system runs dnsmasq as a local DNS forwarder, flush it by restarting the service:

sudo systemctl restart dnsmasq

Or if you use the init.d version:

sudo /etc/init.d/dnsmasq restart

If no DNS caching daemon is running

Some Linux configurations do not run any local DNS caching daemon. In that case, every DNS lookup goes directly to the resolver specified in /etc/resolv.conf, and there is no local cache to flush. The DNS cache may exist at the router level instead. In this situation, you can simply restart the network manager:

sudo systemctl restart NetworkManager

This resets the DNS configuration but does not clear any cache if none is being maintained.

How to Flush Browser DNS Cache

Browsers maintain their own DNS caches separate from the operating system. Even if you flush the OS cache, the browser may still hold old records. Here is how to clear the cache in each major browser.

Google Chrome

  1. Open Chrome and navigate to:
    chrome://net-internals/#dns
  2. Click the Clear host cache button.
  3. Close and reopen Chrome to ensure the cache is fully cleared.

Chrome also has a more thorough method. Open the Clear Browsing Data dialog with Ctrl + Shift + Delete, switch to the Advanced tab, check Cached images and files, and click Clear data. This clears the DNS cache along with the browser's HTTP cache.

Mozilla Firefox

Firefox manages its own DNS cache independent of the OS. To clear it:

  1. Open the Menu (three horizontal lines in the top right).
  2. Click Settings.
  3. Scroll down to Network Settings and click the Settings button.
  4. At the bottom of the connection settings dialog, click Clear DNS Cache.
  5. Close and reopen Firefox.

Alternatively, type about:networking#dns in the address bar and click Clear DNS Cache.

Microsoft Edge

Edge uses the same Chromium engine as Chrome and the same internal page works:

edge://net-internals/#dns

Click Clear host cache, then restart Edge.

Safari

Safari does not have a dedicated DNS cache clearing button. To flush its DNS cache, you need to flush the macOS DNS cache, which covers Safari's requests as well. After flushing the system cache using the macOS instructions above, quit and reopen Safari.

Why both the OS and browser caches matter

If you flush the OS cache but not the browser cache, your browser may still serve stale DNS records. The reverse is also true. For a complete refresh, flush both. This is especially important after changing your DNS server or when a specific site refuses to load.

How to Flush Router DNS Cache

Many modern routers maintain their own DNS cache. When devices on your network request a domain, the router checks its cache first before forwarding the query to an upstream resolver. If the router cache is stale, every device on your network sees the same outdated result.

Reboot the router (simplest method)

  1. Unplug your router's power cable from the back of the unit or from the wall outlet.
  2. Wait at least 30 seconds. This gives the router's memory enough time to fully discharge and clear any cached data.
  3. Plug it back in and wait for all the status lights to return to normal. This usually takes 1 to 2 minutes.

This clears the router's DNS cache along with any other temporary data it was holding. It is the simplest and most universally effective approach.

Clear the cache from the admin panel

Some routers let you clear the DNS cache from the web interface without a full reboot:

  1. Open a browser and enter your router's admin address. Common addresses are 192.168.0.1, 192.168.1.1, or 10.0.0.1. Check the label on your router for the correct address.
  2. Log in with your admin credentials. If you have not changed them, the defaults are usually printed on the router as well.
  3. Look for a DNS cache or DHCP settings section. Some routers have a "Flush DNS" or "Clear DNS Cache" button under advanced settings or network settings.
  4. If you cannot find a specific flush option, look for a DNS settings page where you can modify the DNS servers. Saving any change — even re-entering the same values — often forces the cache to reset.

Flush DNS on ISP-provided routers

ISP-provided router-modem combos often have restricted admin panels. If you cannot access a DNS flush option in the web interface, the power-cycle method is your best option. These devices also often cache DNS at the ISP level, which is beyond your control.

After Flushing — What to Do Next

Flushing the DNS cache is usually a means to an end, not the end itself. Here is what to do after you have cleared the cache.

Run a DNS speed test

After flushing, your system will start fresh with new DNS lookups. This is the perfect time to measure which DNS resolver is actually fastest for you. Our DNS speed test sends real queries to over 17 public resolvers and shows you the actual response times from your location. Run it before and after changing your DNS to see the improvement.

Verify your DNS changes took effect

If you just switched to a new DNS server, confirm the change is active. On Windows, run ipconfig /all and check the DNS servers listed under your active connection. On macOS, run scutil --dns. On Linux, run resolvectl status or check /etc/resolv.conf.

Test the problematic website

If you flushed the cache because a specific website was not loading, test it now. Open the site in a fresh browser tab. If it still does not load, the issue is not DNS — it could be a server outage, a firewall blocking the connection, or a routing problem. Check if the site is down using a tool like DownDetector.

Consider the TTL

After flushing, the first lookup for each domain fetches a fresh record along with its TTL. If the TTL is set to 300 seconds (5 minutes), the cache will repopulate with that same record for the next 5 minutes. If you are actively troubleshooting DNS changes, you may need to flush the cache periodically as new records propagate.

Flush again if needed

If you are migrating DNS records for your own domain and still see old results after flushing, remember that DNS propagation is not instant. Other caching layers — ISP resolvers, intermediate DNS servers — may still hold old records. These will clear on their own as TTLs expire, typically within 24 to 48 hours.

Frequently Asked Questions

Is it safe to flush the DNS cache?

Yes, completely safe. Flushing the DNS cache only clears stored domain-to-IP mappings. It does not delete any personal files, browser history, cookies, or saved passwords. The only effect is that the next few website visits may take slightly longer while fresh DNS lookups are performed. After those initial lookups, everything returns to normal speed.

How often should I flush my DNS cache?

Most people do not need to flush the DNS cache regularly. Do it when you have a specific reason: after changing DNS servers, when a website is not loading correctly, when DNS records are not propagating, or when you see DNS-related error messages. There is no performance benefit to flushing the cache on a schedule.

Will flushing DNS cache speed up my internet?

Not directly. The cache actually makes things faster by avoiding repeated DNS lookups. However, if your cache is holding onto slow or outdated resolver responses, flushing it allows your system to benefit from a faster DNS server you recently configured. For a permanent speed improvement, combine flushing with switching to a fast public DNS resolver.

Do I need to flush DNS cache on my phone?

Yes, phones maintain DNS caches too. On Android, the cache can be flushed by restarting the device or by toggling Airplane Mode on and off. On iOS, restarting the iPhone clears the DNS cache. You can also reset network settings (Settings → General → Transfer or Reset → Reset Network Settings), but this removes saved Wi-Fi passwords as well, so a restart is simpler.

Why does the DNS cache repopulate after flushing?

That is normal behavior. The DNS cache is a performance optimization — your system rebuilds it automatically as you browse. Every time you visit a website, the DNS lookup result is cached again with a TTL set by the domain owner. This is expected and desirable. The cache ensures that repeated visits to the same site are fast.

Does flushing DNS cache affect my VPN?

Flushing the DNS cache does not disconnect or reconfigure your VPN. However, some VPNs maintain their own DNS resolvers and may cache DNS entries internally. If you are using a VPN and troubleshooting DNS issues, flush the system DNS cache as described above, then also restart the VPN client to ensure it picks up fresh DNS entries.

Run a DNS Speed Test Now

See which DNS server is fastest from your location. Takes 10 seconds.