Easy Ways to Flush DNS Cache in Mac, Windows and Linux

Each web server has a unique IP address, and whenever you open a website in your browser, all communication between your computer and web server takes place on the basis of IP address.

When you type www.google.com in your browser’s address bar and press enter, the browser must first know the IP address of the web server that hosts www.google.com, so that it can request it for the web page. This process to translate a domain name into Ip address is called DNS Resolution.

The Process of DNS Resolution (Simplified)

1. When you type www.google.com in the address bar of your browser, the name www.google.com is first checked in the local DNS cache. If the entry is found there, the request for the web page is sent to the respective IP address.

2. If there is no entry in the local DNS cache, then the HOSTS file is checked. If the HOSTS file contains the entry, then the request is sent to that IP address.

3. If both the local dns cache and Hosts file knows nothing about the domain name, then the name is resolved recursively with the help of DNS servers.

Why you need to flush your DNS Cache?

You must flush (clear) the DNS cache whenever you want to get a domain name to be resolved again.

DNS cache ensures that the domain name is resolved fast, so that you don’t have to wait for it. However, sometimes DNS cache may cause some problems like page not loading and 404 errors. This may happen because the web server that hosts a particular web page changed its IP address, but the DNS cache still tries to get the page from the older IP. Also if you register a new domain, you must flush DNS cache so that it is resolved properly on your computer.

How To Flush DNS Cache in Mac, Windows and Linux?

To Flush DNS cache in Microsoft Windows Vista, XP, 200 etc.

  • Open command prompt. Start > Run, type cmd and press enter.
  • Type the command ipconfig /flushdns and press enter.
  • Done!

To Flush DNS cache in Linux, you need to restart the nscd daemon(service)-

  • Open terminal, type /etc/rc.d/init.d/nscd restart and press enter.
  • This command will restart the daemon and your DNS cache will be flushed automatically.

To Flush DNS cache in Mac OS X Leopard-

  • Open terminal, type lookupd -flushcache.
  • This command will flush the DNS cache.

To flush the DNS cache in Mac OS X-

  • Open terminal, type dscacheutil -flushcache.
  • This command will flush the DNS cache.

Important Note – The process explained above is an oversimplified picture of DNS resolution. It is a bit more complex then this. If you are interested in mastering the technical details, then follow the links in the above articles or contact me using the comments.