How to Clear DNS Cache on Your Computer or Device

Share

If websites load slowly, show errors, or direct you to the wrong pages, your DNS cache might have outdated or incorrect information. The DNS cache stores website address lookups to speed up browsing, but when it holds bad data, clearing it forces your device to fetch fresh information. This can fix loading problems and help you reach the correct websites. This guide explains what DNS cache is, why and when to clear it, and how to do so safely on Windows, macOS, Linux, and popular browsers.

Why would you need to clear DNS cache?

Your DNS cache keeps a record of recent website address lookups to make browsing faster by avoiding repeated queries to DNS servers. But when this stored information becomes outdated, corrupted, or incorrect, your device might try to connect to wrong or old IP addresses. This can cause websites to load slowly, show errors, fail to load, or redirect incorrectly. Clearing the DNS cache removes this stored data, so your device requests fresh DNS information. This often resolves problems like websites not loading properly after DNS changes, redirect loops, or suspicions of DNS poisoning. You only need to clear the DNS cache if you notice problems accessing websites or after network changes; regular clearing is unnecessary.

How to clear DNS cache on Windows

  1. Open Command Prompt with administrator privileges: click Start, type "cmd", then right-click Command Prompt and select "Run as administrator".

You must run Command Prompt as administrator; otherwise, the command may fail.

  1. Type the following command and press Enter:
ipconfig /flushdns
  1. You should see a message like "Successfully flushed the DNS Resolver Cache." This confirms the cache was cleared.

This method works on Windows 10, 11, and most earlier versions. If you get an error, check your permissions and try again.

Command prompt window on a Windows 11 PC displaying the ipconfig /flushdns command.

How to clear DNS cache on macOS

Clearing the DNS cache on macOS depends on your version because the command has changed over time.

  1. Open Terminal: find it in Applications > Utilities or search with Spotlight.
  2. Run the command appropriate for your macOS version:
  • For macOS Big Sur (11) and later:
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
  • For macOS Catalina (10.15) and Mojave (10.14):
sudo killall -HUP mDNSResponder
  • For macOS Yosemite (10.10) to High Sierra (10.13):
sudo killall -HUP mDNSResponder
  1. Enter your administrator password when prompted.

There is no confirmation message after running these commands. To check if it worked, visit a website that was causing issues before.

To find your macOS version, click the Apple menu and select "About This Mac."

Terminal window on a Mac computer running macOS Ventura with a DNS cache flush command.

How to clear DNS cache on Linux

Linux systems use different DNS caching services, so the steps vary:

  1. Open a terminal.
  2. If your system uses systemd-resolved (common in Ubuntu and related distributions), run:
sudo systemd-resolve --flush-caches
  1. If you use nscd (Name Service Cache Daemon), restart it by running:
sudo /etc/init.d/nscd restart

or

sudo systemctl restart nscd
  1. For dnsmasq users, restart the service with:
sudo systemctl restart dnsmasq
  1. If you’re unsure which service you have or none apply, restarting your system will clear the DNS cache.

Not all Linux systems cache DNS by default, so flushing the cache might have no effect if no caching service is running.

Browsers keep their own DNS caches separate from your operating system. Clearing both your system and browser caches can help if you still have website issues.

  • Google Chrome:
  1. Current versions of Chrome no longer offer a "Clear host cache" button on the net-internals page.
  2. Close and restart Chrome instead, which clears its DNS cache.
  • Mozilla Firefox:
  1. Type about:networking#dns in the address bar.
  2. Click the "Clear DNS Cache" button.
  • Microsoft Edge:
  1. Current versions of Edge no longer offer a "Clear host cache" button on the net-internals page.
  2. Close and restart Edge instead, which clears its DNS cache.

After clearing your browser's DNS cache, reload the page. This can fix issues caused by outdated DNS data stored in the browser.

How to check if your DNS cache was successfully cleared

You can verify if your DNS cache has been cleared in several ways:

  • On Windows, open Command Prompt and run:
ipconfig /displaydns

If the output is empty or very short immediately after flushing, the cache was cleared.

  • On macOS, there’s no direct command to display the DNS cache. Instead, after clearing it, test by visiting a website that had issues. If it loads correctly and quickly, the cache was likely cleared.
  • On Linux systems using systemd-resolved, check cache statistics with:
systemd-resolve --statistics

The cache size should be minimal or zero after flushing.

  • In browsers, after clearing the DNS cache, sites that failed before should load better or errors should disappear.

If problems continue after clearing caches, the issue might be elsewhere.

When clearing DNS cache might not solve your problem

Clearing your DNS cache fixes local issues but won’t solve every browsing problem.

  • Your Internet Service Provider (ISP) might cache DNS records, so outdated data could still come from their servers, which you can’t clear.
  • Problems with your router, firewall, or network connection won’t be fixed by clearing DNS cache.
  • The website itself might be down or misconfigured, unrelated to your cache.
  • If you use a VPN or custom DNS servers, their caches might also affect results.

Knowing these limits helps you decide when to try other troubleshooting steps.

Conclusion

Clearing your DNS cache is a simple way to fix common browsing problems such as slow loading or wrong website addresses. Whether you use Windows, macOS, Linux, or just your browser, following the right steps refreshes the DNS data your device uses. If issues continue after clearing the cache, check your network setup or ISP, since not all problems come from cached DNS. Most users don’t need to clear DNS cache regularly, but it’s a helpful step when web access acts up.

Frequently Asked Questions

How often should I clear my DNS cache?

Only clear your DNS cache when you experience issues like slow loading, errors, or after network changes. Regular clearing isn’t necessary and doesn’t improve performance otherwise.

Will clearing DNS cache affect my internet speed?

Clearing the DNS cache removes stored address lookups, so the first time you visit a site afterward, it might load a bit slower. After that, your browsing speed should return to normal.

Can I clear DNS cache on my smartphone?

Yes, though methods vary by device. On many smartphones, toggling airplane mode on and off clears the DNS cache. Some apps or system settings also let you clear it. Restarting the device usually helps too.