How to clear your local DNS cache

The DNS cache stores the IP addresses of the websites that you have recently accessed via your web browser. That accelerates access by skipping the process of querying the name servers.

When should you clear your DNS Cache

  • If a website that you have accessed, changes its IP address, you will not be able to access it since the web browser would still be looking at the old address of the server, which is stored in the DNS cache.
  • If you are pointing your domain from one server to another (e.g., you are transferring your website from one host to another), this will change your website's IP. In order to immediately be able to access your website and skip the propagation of the ISP's DNS cache (same as your cache, with the only difference that it is for your internet provider) you would have to clear your cache and also edit the hosts file to explicitly point your domain to the new server's IP.

How to clear DNS cache in Windows

Windows 10

To clear the DNS cache in Windows 10 follow these steps:

  • Use the Search function to look for cmd.
  • Right click on Command Prompt and Run as Administrator.
  • Execute the following command:
ipconfig /flushdns

If the command is executed properly it will provide you with a successfully flushed message.

How to Clear DNS Cache in MacOS

Administrators Access

In order to execute the commands in the steps bellow you must know the administrator's login details

MacOS 10.13 - "High Sierra" and 10.14 - "Mojave"

To clear the DNS cache for MacOS 10.13 & 10.14, you must:

  • Navigate to Applications → Utilities → Terminal
  • Execute the following command:
sudo killall -HUP mDNSResponder; sleep 2

MacOS 10.12 - "Sierra"

To clear the DNS cache for MacOS 10.12, you must:

  • Navigate to Applications → Utilities → Terminal.
  • Execute the following command:
sudo killall -HUP mDNSResponder

How to Clear DNS Cache in Linux

Ubuntu (Linux Debian)

To clear the DNS cache in Ubuntu, you will have to:

  • Press Ctrl+Alt+T to open the Terminal.
  • Execute the following command:
sudo /etc/init.d/nscd restart


Now you know why and how to flush your DNS cache on any of the widely used Operating Systems.

Did you find this article useful?