How Do I Clear My Local DNS Cache?

DNS resolves domain names 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 11:
    • Click the search box on the task bar
    • Type powershell in the search box
    • Click the Windows PowerShell app to open it
  • Windows 10:
    • Click on the Start Menu
    • Type cmd in the search box
    • Click the Command Prompt app to open it
  • 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 completed, type exit to close the command line window.

exit

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 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 by running this command:

sudo aptitude install nscd

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

sudo /etc/init.d/networking restart
Trust your website to an industry leader in website hosting. InMotion Hosting offers secure web hosting with 99.99% uptime, 24/7/365 technical support, and 100% money-back guarantee.
Carrie Smaha
Carrie Smaha Senior Manager Marketing Operations

Carrie enjoys working on demand generation and product marketing projects that tap into multi-touch campaign design, technical SEO, content marketing, software design, and business operations.

More Articles by Carrie

16 thoughts on “How Do I Clear My Local DNS Cache?

  1. 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

    1. 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.

  2. 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

    1. 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

  3. Hi, I am using Windows 10 on a Dell laptop and I added the line needed in my Hosts file (IP example.com 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

    1. 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.

  4. i am using windows 8 i am also 2 times sucessfully clear DNS cache but my site is not open proper show message (https://www.example.com/cgi-sys/suspendedpage.cgi

    This Account Has Been Suspended

    how to solve this problem please solve this as soon as possbile. 

    www.example.com

    1. 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

    2. The instructions you show for OS X 10.10 no longer work as of 10.10.4 as ‘discoveryutil’ was removed with that update. Per https://support.apple.com/en-us/HT202516, they’ve reverted to using “sudo killall -HUP mDNSResponder” for v10.10.4.

    3. 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.

    1. 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

    1. 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

Was this article helpful? Join the conversation!