What Is DNS Cache?

What Is DNS Cache

Date First Published: 23rd January 2022

Topic: Computer Networking

Subtopic: Internet Protocols

Article Type: Computer Terms & Definitions

Difficulty: Advanced

Difficulty Level: 9/10

Learn about what DNS cache is in this article and how to view and flush it.

DNS cache temporarily stores previous DNS lookups on a computer in order to retrieve the IP addresses and translate domain names into IP address quicker, reduce the number of full DNS lookups that are requested from browsers, and overall speed up the DNS process. It is similar to browser cache as it temporarily stores a copy of all pictures, CSS, and JS files in order to make webpages load quicker. When viewing DNS cache, it basically contains a record of all recently visited websites, since every domain name requires a DNS lookup to be fully performed before it is saved in DNS cache. In addition, DNS cache can be useful for remembering a website that was previously visited as it stores a list of all previously visited websites, even if the browsing history is cleared.

How To View DNS Cache On Windows?

Viewing the DNS cache on Windows will display the temporary database of all recent DNS lookups and visits to websites. These steps below can be used for viewing the DNS cache on Windows.

  1. Open the Start Menu. It is the Windows button in the bottom-left corner of the screen. The start menu can additionally be displayed by a simple keyboard shortcut. The keyboard shortcut is the button on the keyboard that has the Windows logo on it.
  2. Find and open the folder 'Windows System' and right-click on 'Command Prompt' and select 'Run as administrator'.
  3. In Command Prompt, copy and paste this command: 'ipconfig/displaydns'. Obviously, do not copy and paste this command with the quotes ('). Command Prompt Screenshot 1

  4. Tap 'Enter' and the DNS cache should display in Command Prompt. Note that if there are entries in the hosts file, which is located c:/windows/system32/drivers/etc/hosts, these will display as well. If there are hundreds of entries in the hosts file, it will make it much harder to view the recent DNS lookups on Windows. The screenshot below is an example of what the DNS cache should look like. Since there were a lot of entries in the hosts file for blocking malicious sites, the screenshot below returned all of those entries. Command Prompt Screenshot 2

How To Flush DNS Cache On Windows?

Flushing DNS cache means to clear and remove all of the temporary storage of previous DNS lookups from a computer. This is useful for resolving DNS-related errors that prevent websites from loading, but previously visited websites may load slower after flushing DNS cache since full DNS lookups will be required. The first two steps that need to be carried out are exactly the same as the previous guide, which was about viewing DNS cache. The difference in these steps is that the command that needs to be typed into Command Prompt in order to flush DNS cache is 'ipconfig/flushdns', instead of 'ipconfig/displaydns'.

  1. Open the Start Menu. It is the Windows button in the bottom-left corner of the screen. The start menu can additionally be displayed by a simple keyboard shortcut. The keyboard shortcut is the button on the keyboard that has the Windows logo on it.
  2. Find and open the folder 'Windows System' and right-click on 'Command Prompt' and select 'Run as administrator'.
  3. In Command Prompt, copy and paste this command: 'ipconfig/flushdns'. Obviously, do not copy and paste this command with the quotes (').
  4. Command Prompt Flush DNS Screenshot 1

    Tap 'Enter' and the DNS cache should be flushed. When the DNS cache is successfully flushed, a message should appear, saying 'Successfully flushed the DNS resolver cache' as seen in the screenshot below.

  5. Command Prompt Flush DNS Screenshot 2

    Close any web browsers and open them again. In order for the flushed DNS cache to successfully take effect, it is necessary to close any web browsers and then reopen them.


Feedback

  • Is there anything that you disagree with on this page?
  • Are there any spelling, grammatical, or punctuation errors on this page?
  • Are there any broken links or design errors on this page?

If so, it is important that you tell me as soon as possible on this page.