Flush DNS: What It Is & How to Easily Clear DNS Cache

Download Now: Free Website Safety Checklist
Anna Fitzgerald
Anna Fitzgerald

Updated:

Published:

Flushing or clearing your DNS cache protects your privacy, helps you resolve HTTP errors, and prevents malicious DNS spoofing.

Flush DNS: Image shows laptop with numbers on it.

Download Now: Free Website Safety Checklist

In this post, we’ll cover everything you need to know about flush DNS, including:

What is DNS cache?

A DNS (Domain Name System) cache is a record of all queries made to a DNS server from your browser. When you input an URL into your browser, your browser sends a request to the DNS server asking for the URL’s IP address. After your browser receives the IP address, it can then load the correct website in your window.

But what happens when you try to access the website a second time? Does the browser have to make a whole new request to the DNS server?

No. By default, most operating systems will cache IP addresses and other Domain Name System (DNS) records in order to fulfill future requests more quickly. This is your DNS cache. The DNS cache prevents browsers from having to make a new request so that, instead, it can use stored information to load the website. This reduces server response times, making the site load more quickly.

Free Website Optimization Checklist

This website optimization checklist will help you perfect your website's:

  • Performance
  • SEO
  • Security
  • Mobile Performance

    Download Free

    All fields are required.

    You're all set!

    Click this link to access this resource at any time.

    What does flush DNS do?

    Flushing DNS will clear any IP addresses or other DNS records from your cache. This can help resolve security, internet connectivity, and other issues.

    For example, when I type in https://lonezscents.com/ in my browser’s address bar for the first time, the browser has to ask DNS servers where to find the site. Once it has that information, the browser can store it in its local cache. Then, the next time I type in that website address, the browser will look for its DNS information in the local cache first and be able to find the site more quickly.

    The problem is that sometimes dangerous IP addresses or corrupted results can be cached and need to be removed. The DNS cache can also impact your ability to connect to the internet or cause other issues. Whatever the reason, all major operating systems allow you to force the process of clearing this cache — or “flushing DNS.”

    It’s important to understand that your DNS cache will clear itself out from time to time without your intervention. That’s because the DNS cache — in addition to saving all information that’s relevant to identifying and finding a website — also saves a component called TTL, or time to live.

    clear cns cache: time to live

    Image Source

    TTL specifies a period of time (in seconds) in which the DNS record for a site remains valid. Within this time period, any queries to the website are answered from the local cache without the help of the DNS server. Once the TTL expires, the entry will be removed from the cache.

    However, there are reasons you may need to force a DNS flush rather than wait for the TTL of all the entries to expire. Let’s take a look at why below.

    Why would you flush DNS?

    There’s a few reasons you might need to flush your DNS cache. These reasons may have to do with security, technical problems, or data privacy. Let’s briefly cover each one below.

    1. You want to prevent DNS spoofing.

    DNS spoofing — also known as DNS cache poisoning — is an attack in which bad actors gain access to your DNS cache and alter the information in order to redirect you to the wrong sites. In some cases, they will redirect you to a fraudulent website that resembles its intended destination so that you enter in sensitive information, like your online banking login information.

    clear cns cache: dns poisoning

    Image Source

    2. You’re seeing a 404 error.

    Let’s say you’ve cached the DNS information of a site that’s since moved to a new domain name or host. In that case, the DNS information on your computer may not get updated right away and you could end up seeing a 404 error or an outdated version of a site when you try to visit. Although the information will eventually get updated in your DNS cache, you don’t have to wait. You can clear the DNS cache at any time.

    3. You’re having trouble accessing a website.

    If you’re having trouble getting a website to load, then you should try other steps first, like clearing your browser's temporary files and cookies and adjusting your browser settings to turn off pop-up blockers and allow sites to save and read cookies. But if you’ve exhausted your options, then you can flush your DNS records and make a new request to the server.

    4. You want to keep your search behavior private.

    When you think of tracking user behavior on the internet, you probably think of cookies — but the DNS cache can reveal your search history as well. That’s because the DNS cache is designed to act like a virtual address book, storing the information of the websites you visit regularly. To keep this information away from data collectors or bad actors on the web, it’s a good idea to regularly flush your DNS cache.

    Now that we understand what flushing your DNS cache means and why you’d want to, let’s walk through how you can do it below.

    The process for flushing DNS varies depending on your computer’s operating system. Let’s go over the process for the major systems below.

    Free Website Optimization Checklist

    This website optimization checklist will help you perfect your website's:

    • Performance
    • SEO
    • Security
    • Mobile Performance

      Download Free

      All fields are required.

      You're all set!

      Click this link to access this resource at any time.

      How to Flush DNS Mac OS X

      The process for flushing your DNS cache on a Mac computer is similar, no matter what software version it’s running. But you will need to know what version for step 6 since the command prompt varies.

      1. Open Finder.

      2. Click Applications.

      3. Scroll down to the Utilities folder and click it.

      4. Open Terminal.

      5. To open Terminal, you could also simply open Launchpad and type in “Terminal” in the search bar.

      Open Launchpad to begin flushing DNS in Mac OS X 10.11-10.15

      6. In the Terminal window, type in the one of the following commands based on your software version:

      • Ventura & Monterey: sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
      • Lion, Mountain Lion, Mavericks, El Capitan, Sierra, High Sierra, Mojave: sudo killall -HUP mDNSResponder
      • Yosemite: sudo discoveryutil mdnsflushcache
      • Tiger: lookupd -flushcache

      Type in command in Terminal to flush DNS in Mac OS X 10.11-10.15

      7. Enter your password and press Enter again.

      8. You should see a message confirming that the DNS cache has been reset.

      How to Flush DNS Windows 10 & 11

      Here’s the processing for flushing your DNS cache on Windows 10 and 11. These steps should also work for Windows 8.1.

      1. Click the Start button. It’s the Windows logo in the bottom left corner.

      2. Select Command Prompt.

      Command prompt selected in Windows 10 start menu to begin flush DNS process

      Image Source

      3. To open the command prompt console, you could also simply press the Windows and R keys at the same time and enter cmd.

      4. You may see a popup asking if you want to allow Command Prompt to make changes to your computer. If you do, select Yes.

      5. If you are asked for an administrative login at this point, then you’ll need to contact your system administrator to proceed.

      6. In the command prompt window, type ipconfig /flushdns.

      Command prompt window in Windows 10 where you type in command to flush DNS

      Image Source

      7. Press Enter.

      8. You should see a message confirming that the DNS Resolver Cache was successfully flushed.

      How to Flush DNS Windows 7

      The process for flushing your DNS cache on Window 7 is nearly identical to that of later versions.

      1. Click the Start button. It’s the Windows logo in the bottom left corner.

      2. Click All Programs > Accessories.

      3. Find Command Prompt. Right-click it, and choose Run as administrator.

      Run as administrator option selected in command prompt to flush DNS in Windows 7

      Image Source

      4. You may see a popup asking if you want to allow Command Prompt to make changes to your computer. If you do, select Yes.

      Popup asking to allow command prompt to make changes on site to flush DNS in windows 7

      Image Source

      5. If you are asked for an administrative login at this point, then you’ll need to contact your system administrator to proceed.

      6. In the command prompt window, type ipconfig /flushdns.

      7. Press Enter.

      8. You should see a message confirming that the DNS Resolver Cache was successfully flushed.

      How to Flush DNS Windows XP and Vista

      The process for flushing your DNS cache on Windows XP and Vista is nearly identical to that of Windows 7. However, the message at the end varies and may require admin intervention.

      1. Click the Start button. It’s the Windows logo in the bottom left corner.

      2. Click All Programs > Accessories.

      3. Select Command Prompt.

      4. In the command prompt window, type ipconfig /flushdns.

      5. Press Enter.

      6. You should see a message confirming that the DNS Resolver Cache was successfully flushed. If you receive a message that says “Action Requires Elevation” instead, then you need to contact the admin of your computer to complete the steps above.

      Free Kit: How to Run an SEO Audit

      Use this kit to start running a better website.

      • SEO Template
      • Audit Checklist
      • Introductory Guide
      • And more!

        Download Free

        All fields are required.

        You're all set!

        Click this link to access this resource at any time.

        How to Flush DNS Linux

        Unlike Windows and Mac computers, Linux systems don’t have a DNS cache by default. However, each distribution might use a different DNS service to store DNS records locally. Depending on the service, you can either clear the cache or restart the service.

        1. Press Ctrl+Alt+T on your keyboard to launch a terminal window.

        Press Ctrl+Alt+T on your keyboard to launch a terminal window to flush DNS in Linux

        Image Source

        2. In the Terminal window, type in the one of the following commands based on the service your Linux system is running.

        • NCSD: sudo /etc/init.d/nscd restart
        • Dnsmasq: sudo /etc/init.d/dnsmasq restart
        • BIND: You may have to try multiple commands:
          • sudo /etc/init.d/named restart
          • sudo rndc restart
          • sudo rndc exec

        3. You may be asked to enter your password.

        4. The service might stop, then start again before sending a confirmation message that the cache was successfully reset.

        Google Chrome is not an operating system, but it does keep a DNS cache of its own. This is separate from your operating system’s cache and from Chrome’s browser cache. If Chrome is set as your default web browser, then you’ll need to clear Chrome’s DNS cache as well as your operating system’s DNS cache.

        Here’s the process:

        1. Type in the following address into your browser’s address bar: chrome://net-internals/#dns

        2. Click the Clear host cache button.

        Clear host cache button will flush Google Chromes DNS cache

        3. All done!

        Flushing Your DNS Cache

        There are a lot of reasons to regularly flush your DNS cache. It can help prevent phishing schemes or other attacks on your computer, direct you to the most up-to-date versions of your most frequently visited sites, restore your internet connection, and keep your data private.

        The best part is how easy the process is. Following the steps above can help you perform a DNS flush quickly and easily, no matter what operating system your computer has. That way, you can move onto your other website development tasks.

        New Call-to-action

        Related Articles

        Keep your website secure with the help of this free checklist.

          CMS Hub is flexible for marketers, powerful for developers, and gives customers a personalized, secure experience

          START FREE OR GET A DEMO