How To Clear DNS Cache in Windows, Linux, and macOS?

It is really important to clear the DNS cache from your computer’s operating system as it can cause various problems. Some malicious websites could get access to your device due to various contaminated DNS. Flushing all these malicious DNS caches from your device would delete unwanted stuff from the system and it would work better.

Clearing out DNS from any operating system either Linux, macOS, or Windows is really easy. Read below to know how to clear DNS cache in Windows, Linux, and macOS.

DNS Cache

DNS server mainly speeds up the search scenario in websites. When you visit a website, DNS saves its IP address so that when you again visit the website it takes less time to open it out. DNS stores various data of the websites. Sometimes the website you want to visit again does not open.

That is because the IP address of the website is no longer the same as DNS saved it. An error would occur and you would not know what in the world has happened to your device and internet.

So when you will flush out DNS Cache, it will delete unlimited data stored in it including IP addresses of various already visited websites. This will automatically enhance user experience and speed and would lessen the chances of getting an error.

How To Clear DNS On Windows?

There are two methods to clear out DNS at your windows computer. Use the method which is more convenient for you.

Method 1: Reset DNS Resolver Cache

In this method, DNS Cache would be cleared out through the windows run command.

  • To pop up the Windows Run Command Window Click Win Key + R.
  • Enter the “ipconfig /flushdns” command in the box and click Enter.
  • In case your Win key is not working in your computer or it’s disabled then type CMD in the search bar.
  • Right-click and select Command Prompt, then click on “Run as Administrator”.
  • DNS cache will be cleared out after the command.

Method 2: Clear DNS Cache using Windows PowerShell

We shall clear out DNS Cache through Windows Powershell

  • Open Start.
  • At the start, look for Windows PowerShell through right-clicking.
  • Select “Run as Administrator”
  • Type the “Clear-DnsClientCache” command in the PowerShell window.
  • Press Enter.
  • All the DNS cache would be removed.
  • These steps work for all windows 8,9,10 and 11.

How to Clear DNS Cache on macOS?

  • Follow these steps to clear DNS Cache from macOS.
  • On the applications folder, find and open the Terminal.
  • Write “sudo killall -HUP mDNSResponder” On the Terminal window.
  • Enter.
  • Type your password on the popup for the administrator password.
  • Again Enter.
  • DNS Cache would be cleared out.

How To Clear DNS Cache in Linux?

For Linux operating systems the method would be slightly different with regard to the DNS service. For different Distros, different DNS services would be used.

Search for the proper DNS service used by the Distro.

Clear Local NCSD DNS Cache

Use the “sudo /etc/init.d/nscd restart” command to clear the DNS cache on the NCSD system.

Clear Local BIND DNS Cache

Use the commands;

  • sudo /etc/init.d/named restart
  • Sudo rndc restart to clean out DNS Cache.

Clear Local dnsmsq DNS Cache

“sudo /etc/init.d/dnsmasq restart” command to clear the DNS cache.

Conclusion:-

These are some ways to clear out DNS Cache from your device according to the operating system. Use the commands mentioned above and you would be good to go.

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button