How to Flush, Clear or Delete the DNS Cache in macOS, Windows, Linux

Published August 27, 2024

How to flush, clear or delete DNS cache How to flush, clear or delete DNS cache

Most operating systems store previous DNS lookup results and store domain-IP address mappings in a local temporary storage called DNS cache. This helps to process future HTTP requests quickly. When a call is made to a website, a DNS lookup request to the local DNS cache is made to see if this domain has been queried before. If yes, the results are retrieved from the locally stored DNS cache. While it is useful, there are times when you need to clear the DNS cache.

Why Flush DNS Cache

There are multiple reasons to flush DNS cache. Flushing DNS cache is the same as deleting or clearing, so we will use these three terms interchangably.

Delete Old DNS Information

Sometimes, DNS records update faster than you realize. If the IP address of a domain is updated and your DNS cache has stored the old information, you will not be able to access that particular website. In this case, it is good to delete the old and stale DNS cache, so that your browser can get updated DNS information.

Prevent 404 Not Found Errors

If a webpage has been giving you 404 Not Found errors after you have used it, chances are that the DNS server has been to be updated and you need to update your DNS cache. The best way for that is to delete or flush your DNS cache, and do fresh queries to get the latest domain - IP mappings.

Handle DNS Poisoning

DNS poisioning or DNS spoofing is a hack attack that poisons your DNS cache by mapping domain names to the wrong IP addresses, so if you were to go to a familiar website, you will actually be redirected to a malicious website that will attempt to steal information and data from you. By flushing DNS cache, the harmful entries will be deleted.

How to Flush DNS Cache on macOS

If you want to delete the DNS cache on a Mac, you will need root access. If you don't have sudo access, you will not be able to clear the DNS cache.

Steps:

  1. Open the Terminal application by going to Finder and pressing command + shift + u and double-clicking on Terminal.app.
  2. Type this in the Terminal:
sudo dscacheutil -flushcache
sudo killall -HUP mDNSResponder
  1. Press Enter. You will be prompted to type your password and press ENTER. When you do that you do that, your DNS cache will be flushed.

How to Flush DNS Cache on Windows

If you want to delete the DNS cache on a Mac, you will need admin access. If you don't have admin access, you will not be able to clear the DNS cache.

Steps:

  1. Start the command prompt by pressing windows key + R.
  2. Type this in the command prompt:
ipconfig /flushdns
  1. You will get a message similar to "Successfully flushed the DNS Resolver Cache.". When you drr that message, you know that your DNS cache has been cleared.

How to Flush DNS Cache on Linux

If you want to delete the DNS cache on a Mac, you will need root access. If you don't have sudo access, you will not be able to clear the DNS cache.

Steps:

  1. Start the Terminal program by clicking on Ctrl + Alt + T.
  2. Type this in the Terminal:
sudo systemd-resolve --flush-caches
  1. You will get a message similar to "Cache cleared". When you see that message, you know that your DNS cache has been flushed.

How to Flush DNS Cache in Google Chrome

If you use Google Chrome as your web browser, it may cache DNS lookup results as well. If you want to flush the DNS cache in your Google Chrome browser, follow these steps:

  1. Open Google Chrome and create a new tab.
  2. Run this command in the address bar and press Enter.
chrome://net-internals/#dns
  1. When you run that command in Google Chrome's address bar, the browser's DNS cache would have been flushed.

How to Flush DNS Cache in Mozilla Firefox

If you use Mozilla Firefox as your web browser, it may cache DNS lookup results as well. To flush the DNS cache in your Firefox browser, follow these steps:

  1. Open Firefox and create a new tab.
  2. Run this command in the address bar and press Enter.
about:networking#dns
  1. Click on the Clear DNS Cache button. That will flush the DNS cache from Firefox.

How to Flush DNS Cache in Microsoft Edge

If you use Microsoft Edge web browser, it may cache DNS lookup results as well. To flush the DNS cache in your Microsoft Edge browser, follow these steps:

  1. Open Edge and create a new tab.
  2. Run this command in the address bar and press Enter.
edge://net-internals/#dns
  1. Click on the Clear host cache button. That will flush the DNS cache from Edge.

How to Flush DNS Cache in Safari

If you use Safari web browser, it may cache DNS lookup results as well, but the flush option will be stored in the Developer settings. To flush the DNS cache in your Microsoft Edge browser, follow these steps:

  1. Open Safari and select the Settings option.
  2. Select **Show Develop menu in menu bar" checkbox.
  3. Go to the Safari menu bar and click on Develop.
  4. Click on Empty Caches in the drop down. This action will flush Safari's DNS cache.

Conclusion

If this blog post helped flush your DNS cache, or not, feel free to let me know. Thanks for reading this blog post.

Related Posts

If you have any questions, please contact me at arulbOsutkNiqlzziyties@gNqmaizl.bkcom. You can also post questions in our Facebook group. Thank you.

Disclaimer: Our website is supported by our users. We sometimes earn affiliate links when you click through the affiliate links on our website.

Last Updated: August 27, 2024.     This post was originally written on August 22, 2024.