How to Flush DNS Cache - Guide for Windows, Linux, and Mac

Did someone tell you to flush DNS cache and you have no clue where to begin? Or maybe, you are encountering countless 404 errors and you know it has something to do with cache.

Whatever your motivation to delete the DNS cache, this guide provides easy but detailed methods for all operating systems. By the end of this guide, you will know how to flush DNS on Windows, Linux, and Mac.

Not only that, but you will also learn why DNS cache is important and how it speeds up your internet.

Without further ado, let’s get down to why we are here.

What is DNS?

The Domain Name System (DNS) translates domain names to IP addresses, which your browser uses to load resources from a server on the internet. It maintains an index of all public domain names and their IP address.

Domain Name System (DNS) translates domain names to IP addressesPut simply, it’s because of the Domain Name System (DNS) that you can access a website by typing its name instead of giving your browser an IP address.

What is DNS Cache and why you need it?

A DNS cache is a temporary database that stores recent DNS lookups on your computer. Your operating system automatically manages this memory to give you a fast browsing experience.

With the memory of recent DNS lookups in the cache, your computer doesn't need to use a DNS server to translate your requested website into an IP address. 

Instead, it looks up in the DNS cache (it's stored locally on your computer) for a similar request made earlier. If you visited the website earlier, your computer handles name resolution locally, without having to send a request to a public DNS server.

This revolutionary way to handle name resolution locally speeds up the internet for you. That’s the reason your computer loads websites quickly that you have visited previously.

So, here is what happens.

  1. You input a URL name in your browser
  2. Your computer looks up for domain name resolution locally in the DNS cache database
    1. Local record found: The web browser access the web server using the IP address from the cache
    2. Local record not found: Your computer sends the request out to the internet for domain name resolution
  3. Once the connection to the server (located by the translated IP address) is made, your computer receives web data and displays it in your browser

Now it’s pretty obvious that without DNS cache, you are going through a longer route to reach your web server. It means you will have to wait longer before you see the web page you want to access.

Can I see the DNS cache of my computer?

Since the DNS cache is stored locally on your computer, you can easily view its content by using a simple command.

Here is what you need to do to view DNS cache on a Windows computer.

  1. Open Run by pressing Windows key and R on your keyboard simultaneously
  2. When you see a dialogue box, type ‘CMD' and press Enter
  3. You should be able to see the command prompt loading now
  4. When the command prompt window is active, type the following press Enter
  5. Now you should be able to see the DNS cache of your computer

Here is how this data may look.
    Record Name . . . . . :
    Record Type . . . . . : 5
    Time To Live  . . . . : 16
    Data Length . . . . . : 8
    Section . . . . . . . : Answer
    CNAME Record  . . . . :
    Record Name . . . . . :
    Record Type . . . . . : 5
    Time To Live  . . . . : 16
    Data Length . . . . . : 8
    Section . . . . . . . : Answer
    CNAME Record  . . . . :
    Record Name . . . . . :
    Record Type . . . . . : 1
    Time To Live  . . . . : 16
    Data Length . . . . . : 4
    Section . . . . . . . : Answer
    A (Host) Record . . . :
    Record Name . . . . . :
    Record Type . . . . . : 1
    Time To Live  . . . . : 16
    Data Length . . . . . : 4
    Section . . . . . . . : Answer
    A (Host) Record . . . :

Why flush DNS? What does flushing do?

DNS cache is extremely important to experience the internet at fast speed. Still, you may have to clear this cache when cache poisoning happens.

Here are some classical cases when you need to clear the cache.

  1. Some technical glitch may corrupt the cache
  2. A computer virus can easily corrupt DNS cache
  3. Invalid entry in the cache may corrupt the data
  4. Malicious websites can load scripts to misdirect DNS request

If any of these cases, your only option is to clear or reset your cache, called DNS flushing. 

When you flush DNS cache, it effectively resets it and clears all the data, including corrupt entries. 

How to Flush DNS Cache on your computer

It takes hardly a minute to clear DNS cache on any operating system. Below, you will learn how to reset the DNS cache on Windows, Mac, and Linux.

Flush DNS cache on Windows

To flush DNS on Windows, you don’t need to be a geek. Follow the simple steps below.

  1. Click on Start and type 'CMD'
  2. Windows will search the program for you
    Tutorial on how to locate the command prompt on windows
  3. Click on Command Prompt and wait for the new window to load
  4. Alternatively, you can open Run and type 'CMD' to open the command prompt window
  5. Once you have the command prompt window active, simply type the following command and press Enter
    ipconfig /flushdns
  6. That’s it!

It will take only a minute to flush DNS on the Windows system.

Flush DNS cache on Linux

If you are running Linux OS, it only takes a single command to flush DNS. Here is the method in easy steps.

  1. Open terminal on your Linux OS
  2. Now based on Linux distribution you are running, run the appropriate command from below list
    1. Ubuntu: sudo service network-manager restart
    2. Other Linux flavors: sudo /etc/init.d/nscd restart

After running the command, it takes just a few seconds to reset the DNS cache on your computer.

Flush DNS on Mac

To flush DNS on Mac, simply follow these steps.

  1. Open Terminal from Utilities
  2. Enter the command based on your operating system version and press Enter
    1. Sierra: sudo killall –HUP mDNSResponder
    2. El Capitan: sudo killall –HUP mDNSResponder
    3. Yosemite: sudo discoveryutil udnsflushcaches
    4. Mavericks: sudo killall –HUP mDNSResponder
    5. Mountain Lion: sudo killall –HUP mDNSResponder
    6. Lion: sudo killall –HUP mDNSResponder
    7. Snow Leopard: sudo dscacheutil –flushcache
    8. Older versions: sudo lookup –flushcache
  3. Once you enter the command and hit the Return key, it will take just a few moments to reset DNS on Mac.  

How to flush DNS cache on your router?

When you are facing issues related to DNS cache, it's important that you also flush the DNS cache on your router. The reason for this is simple. 

Your router can store DNS cache. To understand how it works, consider the following example. 

You visited from a laptop at your home. Then a few minutes later, you visited the same website on your mobile phone. 

When you visited the website the first time, your router looked up for DNS resolution. The second time you sent the request for the same website using a different device. This time the router had already stored the DNS information in the cache and therefore didn't look up and simply return the already-available answer. 

Sometimes, router cache can become messed up. Make sure you secure your wireless router to avoid having to flush it, interrupting your internet experience. 

To reset DNS cache on your router, simply unplug it and plug it back. When the router restarts, all cache is gone. 


A virus or a ‘bad’ entry can easily corrupt DNS cache on Windows, Mac, and Linux. Luckily, you can delete DNS cache (or flush DNS cache) and get rid of all corrupt entries. Make sure you also restart your router just in case the cache stored on it is corrupted as well. It takes only a minute and doesn’t require any technical knowledge.

Asif Mumtaz

After studying physics, mathematics, literature, and law, Asif settled in his hometown to explore his talents as a digital writer. At 35, he lives with his lovely wife and two kids in his hometown and ponders on the nature of reality.  

Show all articles by Asif