How do I clear my local DNS cache?

DNS resolves domain name to IP addresses so people do not have to remember a series of numbers (IP addresses) when trying to visit a website. In order the speed up this process and reduce the traffic on the DNS servers, most computer operating systems will store or cache DNS lookups on your computer locally. At times, you may need to clear the cache to see changes . In this tutorial, we’ll show you how to clear the DNS cache for the major operating systems on the market. Typically, this process is referred to as clearing or flushing the local DNS cache.

Flushing Local DNS Cache in Windows

Open the command line window, and depending on your version of Windows, this can be done in one of the following ways:

  • Windows 7 and Vista:
    • Click on the Start Menu
    • Type cmd in the search box
    • Right click on cmd in the programs search results and choose Run as Administrator
  • Windows 98/NT/2000/XP
    • Click on the Start Menu
    • Select Run
    • Type or select cmd to open the command line window

Once the command line window is open type the following command at the prompt and hit enter

ipconfig /flushdns

After the flushdns is cpmpleted, type exit to close the command line window.

Flushing Local DNS Cache in Mac OS X

OS X 10.10

  • Open a Terminal window
  • Type this command and hit return

    sudo discoveryutil mdnsflushcache

    As of version 10.10.4, Apple has changed the command to the following:

    sudo killall -HUP mDNSResponder

  • Close the terminal window

OS X 10.7 – 10.9

  • Open a Terminal window
  • Type this command and hit return

    sudo killall -HUP mDNSResponder

  • Close the terminal window

OS X 10.6 and below

  • Open a Terminal window
  • Type this command and hit return

    sudo dscacheutil -flushcache

  • Close the terminal window

Flushing Local DNS Cache in Linux

With the various distributions of Linux, you will find that by some run a daemon in the background to manage DNS cache, while others do not. Ubuntu is a good example of a distribution that doesn’t run this daemon by default. If you’re running Ubuntu and you have not already installed the ncsd daemon, you can install it with this command:

sudo aptitude install nscd

To restart the ncsd deamon in Linux, use this command:

sudo /etc/init.d/networking restart

InMotion Hosting is a leading provider of web hosting for both busineses and individuals. Our world class support department is available to assist you 24/7.

Thoughts on “How do I clear my local DNS cache?

  • Hi,

    I’ve uploaded a new home page to my public_html file but it’s not showing on internet? What can I do to resolve this??

    Thanks

    • Sorry for the problem with your new home page not showing. I would first double-check and clear your browser cache. If you haven’t done that on your browser, then it’s possible you’re looking at a saved version of your site from your browser cache. If that doesn’t resolve it, then you should contact support or speak with a web developer to make sure that everything is properly setup.

  • After changing ip address in the host file and when tested it locally, site displays “The requested service is temporarily unavailable. It is either overloaded or under maintanence. Please try later.”

     

    What could be the possible reason /how could i resolve it

    • Hello,

      The most common cause for that error is port 80 not being open on the IP address you are trying to connect to. I would ensure you have entered the correct IP, If you have them I would recommend contacting technical support to have them check the configuration of the site and the server.

      Best Regards,
      Kyle M

  • Hi, I am using Windows 10 on a Dell laptop and I added the line needed in my Hosts file (IP example.com http://www.example.com), I went into cmd as Admin and typed ipconfig /flushdns, I cleared my cache on all internet browsers I use, I did a Disk Cleanup and I restarted my computer and for some reason when I go to my site or open my website WordPress Admin account it is still pointing to my old hosting company. I have not switched my dns yet to point to InMotion beccause I still need to test the site before I do. But I can’t test it if I can’t get my computer to point to InMotions server. Please let me know what else I can try to make sure all cache is cleared. Thanks in advance

    • You may want to check to make sure that you edited the source file as administrator, otherwise the changes won’t be saved. We have a full guide on setting a hosts file in Windows. After following those steps, make sure to clear the browser cache first before testing.

    • Hello Moin,

      Thank you for contacting us. When I navigate to your site, I see “we are sorry but this store is down for maintenance
      please try again later …”

      Have you tried clearing your browser cache, testing in a different browser (such as Chrome FireFox, Safari, IE, etc.), or testing on a different computer, or device?

      Are you able to try on different network, for example if you are on a college campus, library, or coffeeshop.

      If it is only on one computer, check that you have not made any Host File Modifications.

      Thank you,
      John-Paul

    • Hello Jenett,

      Thanks for the information – I did update the article to reflect the change mentioned in the link that you provided.

      If you have any further questions or comments, please let us know.

      Regards,
      Arnel C.

    • Hello Jeffrey,

      Thank you for your suggestion. I have updated the article with the latest information as per your recommendation.

      The steps for clearing cache in Mac OSX should now be accurate.

      If you have any further suggestions, please let us know.

      Thank you,
      John-Paul

    • Hello Pete,

      The command is the same for Windows 8, however is there a certain domain you are trying to go to but your DNS is cached? Can you provide such domain or why you are needing to flush your local DNS cache?

      Kindest Regards,
      TJ Edens

Leave a Reply to Moin Uddin Cancel reply