Skip to content

What is DNS cache and how does it work?

  • by
  • 3 min read

Domain Name System (DNS) maintains the database of the IP addresses in computer-readable format. When the user enters a website’s URL in the browser, a series of procedures follow. The request for the website goes to the DNS resolver, and then the resolver asks the root server, which then sends it to the TLD server. Needless to say, this process is time-consuming.

Caching is a process of storing the data temporarily in a device. In the same way, DNS caching is the temporary storage of the websites previously visited by the user. Simply speaking, DNS cache is the record of all the previous lookups by the user.

How does DNS cache works?

DNS lookup process comprises several steps. When the search result is positive, it is stored as a cache, for further use by the computer. Please note that DNS cache works at all the levels (resolver, root server and TLD) of the DNS lookup, and not just at the OS or browser level.

Every server at every level of the DNS lookup first looks in their respective cache for the information. It means that even if the DNS cache of the browser or the OS is empty, the resolver can still check its cache for the information, nullifying the need for further steps.

Also read: How to use Ping command to test your internet network

Why clear DNS cache? 

Clearing the DNS cache is desirable when the following situations occur.

  • If there are any connectivity issues arising, DNS flushing is used.
  • To fix DNS spoofing.
  • If, by chance, the website has moved its servers, then clearing the DNS cache will fix the issue.

How to view and clear DNS cache on the local device?

DNS cache in Windows

The process of viewing the DNS cache depends on the type of operating system. Below, we are exploring ways to check the DNS cache on various operating systems.


Following are the steps to view the command prompt in Windows.

  • Open the command prompt by typing cmd in the start menu.
  • On the window, type the command ipconfig /displaydns.

To clear the DNS cache, just type the command ipconfig /flushdns in the command prompt.


To view the DNS cache in macOS, follow the below steps.

  • Open the Console app.
  • Enter any:mdnsrespondr into the search bar by selecting the device from the left sidebar.
  • Next, open the command line and type the command sudo killall -INFO mDNSResponder. 
  • The user can go back to the console app and can see the DNS cache list.

To clear the cache, just go to the command line interface and type the following command sudo killall -HUP mDNSResponder.

Google chrome

To view the DNS cache, just type chrome://net-internals/#dns into the address bar.

To clear the DNS cache, type the previous command to view the cache and then click on the Clear Host Cache button.

For further information about how to clear the cache, refer to the following article.

Also read: Terminal vs Graphical User Interface

Kumar Hemant

Kumar Hemant

Deputy Editor at Candid.Technology. Hemant writes at the intersection of tech and culture and has a keen interest in science, social issues and international relations. You can contact him here: