Please note: This website includes an accessibility system. Press Control-F11 to adjust the website to people with visual disabilities who are using a screen reader; Press Control-F10 to open an accessibility menu.

How Do I Clear My Local DNS Cache?

How Do I Clear My Local DNS Cache?
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 taskbar
    • 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 program 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

    OS X 10.7 and above

    • Open a Terminal window from Applications > Utilities.
    • Type
      sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
      and press Return.
    • 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

    To easily clear the cache on an iOS device, turn on Airplane Mode for 5-10 seconds and turn it back off by going to Settings > Airplane Mode. Alternatively, you can reboot your phone.

    Flushing Local DNS Cache in Linux

    Flushing the local DNS cache on Linux depends on which service handles your DNS caching. Typical services include systemd-resolved, nscd, dnsmasq, or BIND. Below are the typical methods for each:

    To clear the cache on an Android device, open Chrome, tap the three vertical dots at the top-right corner, choose History, and then tap Clear browsing data.

    1. systemd-resolved (Ubuntu 18.04+, many modern distributions)

    If your system uses systemd-resolved, you can flush the DNS cache with:

    sudo systemd-resolve --flush-caches

    To confirm that your system is using systemd-resolved, check:

    systemctl is-active systemd-resolved

    and/or verify that /etc/resolv.conf is managed by systemd-resolved.

    2. nscd (Name Service Cache Daemon)

    If you have nscd (Name Service Cache Daemon) installed:

    sudo systemctl restart nscd

    or on older (SysVinit) systems:

    sudo service nscd restart

    If nscd is not installed, you can typically install it on Debian/Ubuntu with:

    sudo apt-get install nscd

    and on Fedora/CentOS/RHEL with:

    sudo yum install nscd

    3. dnsmasq

    If you are running dnsmasq as a local DNS server/cache, restart it:

    sudo systemctl restart dnsmasq

    or on older systems:

    sudo service dnsmasq restart

    4. BIND

    If you’re using BIND as a caching DNS server, you can clear the cache by running:

    sudo rndc flush

    If you want to flush only specific domain entries, you can use:

    sudo rndc flushname example.com

    5. NetworkManager (alternative approach)

    Some Linux distributions (notably Ubuntu or Fedora) will also leverage NetworkManager for DNS settings. You can try:

    sudo systemctl restart NetworkManager

    This doesn’t directly flush a DNS cache if you don’t have a dedicated caching service running, but it may reset DNS-related states.

    Checking Which Method Applies

    Check if systemd-resolved is active
    systemctl is-active systemd-resolved
    Check if nscd is running:
    systemctl status nscd
    Check if dnsmasq is active:
    systemctl status dnsmasq

    Pick the flush method based on which service is actually in use.

    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.

    5. Youshould update these infos.

      Use what apple suggests :

      https://support.apple.com/en-ca/HT202516

      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!