How to Clear Your DNS Cache in Mac, Windows & Chrome? (Best Guide)

Troubleshooting your website can be an intimidating responsibility. When it comes to tasks like flushing your Domain Name Server (DNS) cache, it’s easy to get overwhelmed and confused before you even start. In this blog, we go through a quick and easy guide on how to clear your DNS cache on Mac, Windows, or Chrome.

Fortunately, to learn how to clear DNS cache, you do not need any significant technical experience. In two short steps, your DNS cache will be clear, and you can continue working to resolve whatever issue you happen to be facing.

What is DNS Caching?

In order to understand why you may need to flush your DNS cache, there are several components we need to break down.

First, the Domain Name System (DNS) is an index of all the websites on the internet and their IP addresses. You can think of it as a directory or phone book for websites. As for ‘caching’, it’s the process of saving a snapshot of something (such as a web page) so it can be reloaded faster in the future.

So, DNS caching involves your Operating System (OS) or browser capturing recently-visited IP addresses and saving them in a database. This enables your browser to reload sites you’ve visited in the past more quickly than if it had to reference the DNS again each time.

In a nutshell, just like your browser cache stores images, HTML files, and stylesheets – your DNS cache stores the IP addresses (locations of sites) you have recently visited on your computer.

If your site is in the process of being moved from one server to another, or from one hosting company to another, you might need to clear your DNS cache so you can grab the most up-to-date records.

There are multiple WordPress caching plugins available. One such plugin is WP Rocket. If you’re planning to buy this magic plugin, we have some exclusive offers for you. Apply our latest wp rocket coupon codes for all your WordPress caching tasks.

Why Do You Need to Clear Your DNS Cache?

Most operating systems perform DNS caching to lessen the DNS servers’ burden during high traffic. Its TTL determines the cache’s validity period. As long as the cache files are still valid, they will answer content requests without going through the DNS server.

Despite this, using corrupt or outdated DNS cache files can lead to errors and security vulnerabilities. Your operating system may store a bad DNS cache when you visit websites that just moved to a new domain name or host. Therefore, we recommend flushing your DNS cache periodically.

Here are the reasons why you should clear your DNS cache regularly:


DNS cache files are the main target for DNS spoofing, which endangers users’ sensitive information like login credentials and personal data.

Technical Issues

Forcing the operating system to search updated DNS records can solve connection issues and incorrectly displayed web content. Let’s try to break the above parameters into brief scenarios explaining why and when you ‘need’ to clear your DNS cache.

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. Avoid adding any sensitive information like your online banking login information.

404 Errors

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. Hence, 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. Read more in our detailed guide on how to fix WordPress posts returning 404 error.

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 allowing sites to save and read cookies. But if you’ve exhausted your options, then you can flush DNS to reset your computer’s connection to the internet.

Keep Your Search Behavior Private

Storing DNS records makes it easier for hackers to predict your browser history. 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 as 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.

How to Clear Your DNS Cache In Various Devices & OS?

Depending on your operating system, the steps to flushing a DNS cache may vary. The tutorial below will show you how to clear DNS cache on Windows, Linux, and Mac OS X.

How to Clear Your DNS Cache In Microsoft Windows

Flushing your DNS cache on Windows is a relatively simple process. Keep in mind that you need to run as an administrator when executing the command prompt to access all system security permissions. 

Here are the steps to flushing DNS cache on Windows XP, 7, Vista, 8, 8.1, and 10.

  1. Press Windows+R keys together or right-click Windows’ Start menu and then click Run. Type cmd to open the Windows command prompt console. If you don’t have administrator privileges yet, run the cmd command by pressing Ctrl+Shift+Enter.
  1. Type ipconfig /flushdns on the command prompt and press enter. This command will clear DNS cache files on your computer and reset the DNS resolver cache.
  1. If the process is successful, you’ll see the confirmation message on your command prompt as follows:
clear dns cache in windows command prompt

How to Clear Your DNS Cache In Linux

By default, Ubuntu doesn’t cache DNS records. If you manually install a DNS service like name service caching daemon (NSCD), the steps below will show you how to flush the DNS cache on your computer. Make sure to run as administrator when following these steps.

  1. Press Ctrl+Alt+T keys together to open the terminal window.
  2. Enter the following command line to clear DNS cache files on the init.d subdirectory:
sudo /etc/init.d/nscd restart

Here is the guide to flush the DNS cache on a system that uses systemd.

  1. Press Ctrl+Alt+T keys together to open the terminal window.
  2. Type the following command line:
systemd-resolve --flush-caches
  1. Enter the following in the command prompt to check if the previous command has successfully flushed the DNS cache.
systemd-resolve --statistics

How to Clear Your DNS Cache In Mac OS X

While the steps to flushing a DNS cache on Mac OS X are simple, you need to run the right command.

  1. Press the F4 key, then enter terminal in the Launchpad’s search field to open the command terminal window.
  2. If you’re using Mac OS Sierra, X El Capitan, X Mavericks, X Mountain Lion, or X Lion, enter the following in the command prompt:
sudo killall -HUP mDNSResponder
  1. To flush DNS cache on Mac OS X Yosemite, enter the command:
sudo discoveryutil udnsflushcaches
  1. If you’re running on Mac OS X Snow Leopard, use the command:
sudo dscacheutil -flushcache
  1. For Mac OS X Leopard and below, enter the following command to flush the DNS cache:
sudo lookupd -flushcache
  1. To flush DNS cache on Mac OS X High Sierra, enter this in the command prompt:
sudo killall -HUP mDNSResponder
  1. Here is the command to flush DNS cache on Mac OS X Mojave:
sudo killall -HUP mDNSResponder
  1. If you’re running on Mac OS X Catalina, use this command:
sudo killall -HUP mDNSResponder
  1. Here is the command to flush DNS cache on Mac OS X Big Sur:
sudo dscacheutil -flushcache;
sudo killall -HUP mDNSResponder

How to Clear Your DNS Cache In Chrome

As Google Chrome stores a separate DNS cache from system OS, flushing them will have the same benefits. This is particularly important if you use Google Chrome as your main web browser.

Keep in mind that this cache type is different from the browser cache. 

Here are the steps to do it:

  1. Open Google Chrome and enter the following address into its address bar:
  1. On the net internal settings page, select Clear host cache.
clear DNS cache in chrome


The prospect of clearing your DNS cache may sound daunting, especially if you’re new to troubleshooting internet connectivity. Fortunately, the actual process is fairly straightforward.

Flushing your DNS cache only requires a few steps. First, you need to know what OS and version you’re using. Then, you can follow the relevant steps above and clear your DNS cache by entering one or two simple commands. 

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.