Modern operating systems generally cache DNS lookup results and IP addresses to be able to process requests more quickly. Whenever you write a URL in your browser, it sends a request to the DNS servers to “locate” the site. 

But, instead of sending that request every single time, the browser often caches the information, so the next time you type in that address, the browser just looks it up through the DNS cache to return the results quickly. 

However, flushing your DNS cache from time to time is a good way to protect yourself from phishing scams (we’ll explain this risk later in this article), and to make sure that you’re redirected to the most up-to-date versions of the site you’re trying to reach. 

When you flush the DNS, it removes all DNS records. Here’s how to do it on different operating systems. 

How to Flush DNS on Windows 11

If you’re using Windows 11, here are the steps you can follow to flush the DNS cache.

  1. Click on Start, then select Command Prompt. 
  2. Once you have Command Prompt open, write ipconfig /flushdns.
  3. Press Enter. 
  4. A message will appear on your screen, confirming that the DNS Resolver Cache was flushed.

How to Flush DNS on macOS

Here are the steps you need to follow if you want to flush the DNS on macOS. 

  1. Press cmd + space to open Spotlight Search.
  2. Type Terminal. 
  3. You can also find it in Other in the Launchpad. 
  4. Type the following command: sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
  5. Your Mac will ask for your password. Once you enter that in, you’ll get a message that the DNS was successfully flushed.

How to Flush DNS on Linux 

If you’re using a Linux distro, such as Ubuntu, here are the steps to follow if you want to flush the DNS:

  1. Like macOS, you’ll have to use the command-line interface on Linux to flush the DNS cache. Click on Activities from the top-left on the desktop. 
  2. You’ll see a search bar. Just type terminal to access it. 
  3. Run this command by typing it and pressing Enter: sudo systemd-resolve --flush-caches
  4. You’ll be asked to enter your password. Once you do, it’ll flush your DNS cache.

How to Flush your DNS Cache on Google Chrome

Your browser’s DNS cache may also need to be flushed now and then. To do that, run the following command by typing it in your address bar and pressing Enter:

chrome://net-internals/#dns

This command will flush the Google Chrome DNS cache. 

Why Flush Your DNS Cache?

There are several reasons why you should consider flushing the DNS cache. Here are a few.

Prevent DNS Spoofing

DNS spoofing or poisoning is an attack perpetrated by malicious actors to access your DNS cache. Once they access it, they can essentially redirect you to harmful or spoofed sites to steal your data. Flushing your DNS cache protects you from that. 

Avoiding 404 Errors

If a website’s giving you a 404 error, it’s possible that you’re trying to access an outdated version of the site. By flushing your DNS cache, you’ll be able to correct this and may find you’re able to access the website again. 

Remove Old DNS Data

There are several DNS providers out there, including Open DNS and even Google. Once you change your DNS provider, it’s important to flush the DNS cache to ensure that your browser doesn’t pull data from the older cache. 

After Action Report — Flush Your DNS Cache Periodically

The process to flush your DNS cache is fairly straightforward. It also protects you from DNS spoofing and other harmful activities. While the DNS is regularly cleared out by itself, it doesn’t hurt to play it safe and clear it now and then yourself!

Do you regularly flush your DNS cache? Let us know if you have anything to add! Join the conversation below by leaving a comment! 💬