How To Flush The DNS Cache In Windows

The Microsoft Windows operating system stores all DNS look-ups in a cache to speed up the connection for future visits to previously visited websites or servers. DNS for simplifications sake turns domain names like ghacks.net into IP addresses like 96.30.22.116. To simplify it further: computer users make almost exclusive use of domain names, while computers and devices of IP addresses.

The DNS provider is queried during each connection attempt unless the information are already stored in the cache.

You may want to know why someone would want to flush the DNS cache? Lets say you have decided to switch from your provider's DNS server to Open DNS, Google DNS or another free service that promise faster speeds and little extras like user-configured site filtering. If you switch during a session, you will be using old data from the cache if you access sites that you have already visited.

Not a big problem? You may be right, but think about the following situation. A webmaster migrates the website to a new server. It can take up to 48 hours before all DNS servers redirect users to the website on the new server and not the old server. Some webmasters change their DNS server before migrating if the ISP's DNS server is known to be on the slow site when it comes to updating information (another option for webmasters is to edit the hosts file).

The DNS cache can have privacy implications as well, especially on public computer systems or multi-user systems. It is possible to display the contents of the cache, which in turn reveals all the websites that have been visited by the user in the session. Flushing the cache removes the entries so that the next user won't be able to see a list of visited websites.

Flushing the DNS Cache

On to the commands. Windows users need to open a command prompt to flush the DNS cache. The easiest way to do that is to press Windows-r, type cmd, and hit the enter key.

The command ipconfig /flushdns clears the DNS cache. All records up to this point in time are removed from the cache.

C:\Users\Martin>ipconfig /flushdns
Windows IP Configuration
Successfully flushed the DNS Resolver Cache.



ipconfig flushdns

Displaying the DNS Cache

You can test if the DNS cache has been flushed with the command ipconfig /displaydns. Please note that the command may still display entries, but those are new entries that have been added to the cache after it has been flushed. Antivirus software may for instance connect automatically to update servers.

C:\Users\Martin>ipconfig /displaydns
Windows IP Configuration

ipconfig displaydns

Turning Off DNS Caching

DNS caching can be turned off for a session or completely. The negative effects are that look-ups may take longer, especially in computer networks with connected network shares and devices. Computer workstations without network connections on the other hand are likely not negatively effected by the operation. It is probably best to experiment with the setting first, by disabling it temporarily for a session.

Read also:  Windows 10 14936: Uninstall System Apps

The command to stop the DNS Cache for the active session is net stop dnscache. Please note that you need administrative privileges to run the command successfully. Windows 7 users can do that by clicking on the start menu orb, selecting All Programs > Accessories, right-clicking on Command Prompt and selecting Run as Administrator. The path should be similar for other versions of Windows.

c:\windows\system32>net stop dnscache
The DNS Client service is stopping
The DNS Client service was stopped successfully.

stop dns client service

You can start the DNS client service again with the command net start dnscache.

The previous instructions turned off the DNS cache for a single session. A restart would load it as a service again. It is however possible to turn off the DNS cache completely. This is done with the shortcut Windows-r, typing services.msc and hitting enter.

Locate the service DNS Client in the listing and double-click it. The window that opens offers controls to stop the service for the current session, and to change its startup type from manual to disabled.

dns client service

Disabled means that it won't be started with Windows, which effectively disables the DNS Cache permanently. Another benefit of this is that other users are not able to display the DNS cache to retrieve a list of visited websites and servers.

Windows users who are thinking about disabling the DNS Cache permanently should test it first by disabling the cache for the session. If they do not notice performance drops or slower than usual connections they could go ahead and disable the cache completely.

Please share this article

Facebooktwittergoogle_plusredditlinkedinmail


Filed under:


Responses to How To Flush The DNS Cache In Windows

  1. mike1354 March 13, 2011 at 12:47 pm #

    or download ccleaner ..

  2. hlm March 13, 2011 at 12:56 pm #

    I've disabled the DNS Services since I'm using the the custom hosts file. Is it true that disabling the services will make webpage load faster?

    • Martin Brinkmann March 13, 2011 at 2:12 pm #

      HLM I doubt it but have not tested the effect yet.

    • Dan March 15, 2011 at 11:08 pm #

      No, I would imagine it's just the opposite. Your DNS cache remembers websites that you've been to in that session, so when you type google.com the dns cache remembers its DNS and the site loads faster. I suppose it could slow down new sites.

  3. yk943249 March 13, 2011 at 6:43 pm #

    Could you pls recommend some free softwares for DNS flushing, Say, Flush 0.9.2?

  4. Fish March 14, 2011 at 1:40 am #

    Hostsman can quickly flush DNS cache.

  5. Thomas Baumann March 21, 2011 at 9:29 pm #

    Disabling the dns cache will slow down your internet connection, because the domain name must be retrived on almost each request which takes a lot of time. I don't know any reason why someone would do this. In fact I have raised the time for the dns cache on my machine. Also I have added several domain names to my hosts file to save a lot of dns requests.

    If you only want to flush the dns cache type "ipconfig /flushdns" into a command prompt. There is no need for a software doing that. You can create a shortcut for this, too.

    If you want to speed up your internet connection use something that blocks commercials. You may want to add frequently used host names to your hosts file, too. I have created an application for that if someone is interested (recommended only for users that know what a hosts file is): http://ahe.devs-on.net

  6. Som June 13, 2012 at 10:00 pm #

    This problem is a big problem and only they know who have suffered from this . I am a Linux user .But , the way i have solved the issue is applicable for both Linux or Windows users . If a user gets this problem and if he / she uses Internet through high speed LAN connection , this trick will surely work for him/her . Here , we need just to change the DNS entry . Generally , in LAN connection, a user is provided two IP addresses. One is primary address and another is secondary or alternative address . We just need to set5 up the secondary or alternative address as primary address and the primary address as alternative address .Hope this will solve the issue .

Leave a Reply