Simplified Guide on How to Clear DNS Server Cache on Windows

By Staff Contributor on May 15, 2020

Sites often try to record information about visitors, which is why you’re often asked if you accept the use of cookies. When users want to remove the information collected, they clear the cache of their browsers.

What many people don’t realize, though, is information is also stored in the domain name server (DNS) cache. This guide will explain in more detail what the cache is, how it’s used, and why it’s important to sometimes flush the DNS server cache. It’ll also touch on the benefits of using a tool like SolarWinds® Server & Application Monitor (SAM) to keep tabs on DNS performance and clear the cache when called for.

How Does a DNS Cache Work?
Why Flush a DNS Cache?
How to Clear DNS Server Cache
Clearing DNS Cache on Windows Server with Command Prompt
Clearing DNS Cache on Windows DNS Server
Clearing DNS Cache with Windows PowerShell
Recommended Tool to Keep DNS Cache Clear

How Does a DNS Cache Work?

When you type a domain name, such as, into a browser, the name has to be translated into an IP address before the results are displayed. DNS servers perform this conversion from name to IP address, and vice versa.

Even with many DNS servers available, it can take a while to get a response. To get around this, operating systems create their own cache for website addresses that have been called and resolved.

These DNS caches store information for a certain period. This means if the user returns to a recently visited website, instead of looking up the information all over again, the browser can get the details from the cache and return results more quickly. The operating system isn’t the only place storing information—each step of the lookup process contains its own DNS cache.

To make this work, the DNS cache includes resource records (RRs), which are displayed in ASCII code. The components of RR include:

  • Resource data (or rdata): This describes the record. For example, it identifies the host name or address.
  • Record type: This refers to the type of entry. The “A” record type is what contains the IP address for the host name.
  • Record name: This is the optional value of the object’s domain name.
  • Time to live (TTL): TTL is an optional value to indicate how long the resource record is valid, displayed in seconds.
  • Class: This is an optional field for the protocol group for the RR (most commonly “IN” for internet).
  • Resource data length: This is an optional field to store the length of the resource data.

This information is useful for speeding up search results, but you may want to remove the stored data even before the TTL expires. Clearing the browser cache won’t address this, which is why you need to clear the DNS cache on Windows or even on the DNS server.

Why Flush a DNS Cache?

It’s important to flush a DNS cache for a few reasons.

The first is the cache may contain outdated information. You might experience this as difficulty accessing websites or applications. If the domain name in the cache points to an old or incorrect IP address, the website won’t return the correct information. Even if you clear your browser history, the DNS cache will still have the old information, and the server needs to be flushed to get the updated results.

Another reason to clear the cache is privacy. Although the DNS cache doesn’t contain the same type of information stored in cookies or JavaScript, it does retain a history of which addresses you’ve visited recently, including those you go to on a regular basis. The more information stored means less privacy if someone gets access to the cache.

Finally, clearing the cache is important for security reasons. It’s possible for cybercriminals to access the cache and insert or change the IP addresses. This is called DNS poisoning or DNS spoofing, and it can redirect you to a website designed to gather sensitive data, such as passwords to online accounts.

For companies relying on the internet to do business, it’s critical to maintain proper security and keep things running smoothly. Clearing the DNS server will remove any invalid addresses, whether because they’re outdated or because they’ve been manipulated.

It’s also important to note flushing the cache doesn’t have any negative side effects. The first time you visit a site after clearing the cache, the site might be a little slower than usual, but after, the results will speed up again.

why flush DNS cache

How to Clear DNS Server Cache

You may choose to clear the DNS cache as a preventive measure or because you’ve noticed a problem, such as a page redirecting to the wrong site.

In other cases, you might discover a problem through the use of a DNS monitoring tool  such as SolarWinds Server & Application Monitor. Using a tool can help you keep track of DNS performance and identify issues before they cause a serious problem. With a tool like SolarWinds SAM installed, you may also receive an alert or notice other information prompting you to clear the cache.

Whatever the reason, here’s how to flush a DNS server for Windows, using a command line or PowerShell. If you work with a DNS monitoring tool like SAM, you may also be able to use the solution to flush the server.

Clearing DNS Cache on Windows Server With Command Prompt

Using the command prompt to clear the cache is straightforward:

  1. Click on the Start button and type cmd
  2. Open the command prompt
  3. Enter the following command in the prompt:

That’s all you need to do. You should then get a message indicating the cache has been successfully flushed.

If you want to view the entries before clearing the cache, open the command prompt and type the command:


 You can then review the entries and decide if you want to proceed with flushing the DNS.

Clearing DNS Cache on Windows DNS Server

If the cache problem is on the server instead of the local machine, you can still use the command prompt, but with a different command. In this case, it would be:

dnscmd /clearcache

Clearing DNS Cache With Windows PowerShell

If you want to clear the DNS cache using PowerShell, you have a few options, depending on which cache you want to clear:

  • To clear the client cache, use the command:


  • To clear the local DNS server cache, use this:


Getting accurate results when you use the internet is critical, and to ensure those results are valid and up to date, you need to periodically flush the DNS server cache. You can do this manually, or you can use a DNS monitoring tool.


If you use a monitoring tool such as SolarWinds Server & Application Monitor, you’ll be able to do more than clear the cache. The tool will help alert you to any problems before they become critical and allow you to monitor performance and review domain names. SolarWinds offers a 30-day free trial of SAM, during which the software is fully functional. 

Related Posts