≡ Menu

How to flush DNS cache

This post explains how to view / flush DNS cache on the local machine from command prompt. The DNS resolver cache stores the IP addresses for the websites recently visited from this computer. The cache entries can be retrieved using the below command.

ipconfig /displaydns

Example:

C:\>ipconfig /displaydns
Windows IP Configuration

    www.windows-commandline.com
    ----------------------------------------
    Record Name . . . . . : www.windows-commandline.com
    Record Type . . . . . : 5
    Time To Live  . . . . : 272
    Data Length . . . . . : 8
    Section . . . . . . . : Answer
    CNAME Record  . . . . : windows-commandline.com

    www-google-analytics.l.google.com
    ----------------------------------------
    Record Name . . . . . : www-google-analytics.l.google.com
    Record Type . . . . . : 1
    Time To Live  . . . . : 58
    Data Length . . . . . : 4
    Section . . . . . . . : Answer
    A (Host) Record . . . : 216.58.216.142

There are more DNS records printed for the above example, showing only couple of records here.

Flush DNS cache

Now let’s see how can we flush the contents of DNS cache. This is frequently used by domain admins when they update the hosting server address in their domain settings. Flushing removes the record stored on the local host and triggers contacting the domain name servers on the internet for the IP address.

Command to flush dns cache

ipconfig /flushdns

Example:

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

Now if you print dns cache records you may not see anything.

C:\>ipconfig /displaydns
Windows IP Configuration
Could not display the DNS Resolver Cache.

Note that it’s not guaranteed to see empty output with /displaydns command, as there could be some application contacting some website in the background and the DNS cache is filled with new records immediately. But you can rest assured that all the previously cached records were deleted.

FAQ

  1. Q: DNS still points to the old IP even after flushing the cache and updating IP on domain name server(DNS server).
    A: This would be because the update you made on your hosting DNS server would take some time to propagate to all other DNS servers over the internet. The DNS server  your computer is looking up might not have received the update yet. The latency could vary from few seconds to few hours.
2 comments… add one
  • Sean

    I cleared dns cache multiple times but still ping domainname shows the old ip address configured, does not update to the new address I added on my domain registrar,

  • peter bunzy

    Hello how can flushdns from pc network

Leave a Comment