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 system. By the end of this guide, you will know how to flush DNS on Windows, Linux, and Mac.

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.

To put simply, it’s because of the Domain Name System (DNS) that you are able to 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.

You input a URL name in your browser

Your computer looks up for domain name resolution locally in the DNS cache database

Local record found: The web browser access the web server using IP address from the cache

Local record not found: Your computer sends the request out to the internet for domain name resolution

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.

Open Run by pressing Windows key and R on your keyboard simultaneously

When you see a dialogue box, type ‘CMD' and press Enter

You should be able to see the command prompt loading now

When the command prompt window is active, type the following press Enteripconfig/displaydns

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 DNS cache on Windows, Mac, and Linux.

Flush DNS cache on Windows

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

Click on Start and type 'CMD'

Windows will search the program for you

Click on Command Prompt and wait for the new window to load

Alternatively, you can open Run and type 'CMD' to open the command prompt window

Once you have the command prompt window active, simply type the following command and press Enteripconfig /flushdns

That’s it!

It will take only a minute to flush DNS on 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.

Open terminal on your Linux OS

Now based on Linux distribution you are running, run the appropriate command from below list

Ubuntu: sudo service network-manager restart

Other Linux flavors: sudo /etc/init.d/nscd restart

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

Flush DNS on Mac

To flush DNS on Mac, simply follow these steps.

Open Terminal from Utilities

Enter the command based on your operating system version and press Enter

Sierra: sudo killall –HUP mDNSResponder

El Capitan: sudo killall –HUP mDNSResponder

Yosemite: sudo discoveryutil udnsflushcaches

Mavericks: sudo killall –HUP mDNSResponder

Mountain Lion: sudo killall –HUP mDNSResponder

Lion: sudo killall –HUP mDNSResponder

Snow Leopard: sudo dscacheutil –flushcache

Older versions: sudo lookup –flushcache

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 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 router-reset.com 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 cache and therefore didn't look up and simply returne the alreay-available answer.

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

Conclusion

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.

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.