flush dns

How to Clear the DNS cache on Windows, Linux and Mac

If your Internet connection isn’t working correctly or you’re not able to browse a website that you want to, chances are that your DNS cache might be corrupted. In this post you will learn about the advantages of clearing your DNS cache and how to do it on multiple operating systems.

What is a Domain Name System?

DNS stands for the Domain Name System. This is a system that automatically converts easy to remember domain names like Google.com to IP addresses (like 12.324.6.789) that are the actual addresses for a website. The DNS service will make browsing for a website easy.

What is a DNS server?

A DNS server is a service that is run by your Internet Service Provider (ISP) to map all these IP Addresses to their easy to remember names. When you enter a name to a website, the DNS server will provide the IP address to the website and therefore, you can browser the website.

What is a DNS Cache?

The DNS Cache is a set of files that are temporarily stored on your computer. There it will keep the information of the websites that you visit regularly and it doesn’t require your browser to go to the DNS service each time you visit the same website. This actually makes your web browsing experience much faster.

Why should I clear my DNS cache regularly?

An operating system will store cache files called Domain Name System cache. These files store information about all the visited websites like host name, IP addresses and the resource records. This is done to speed up Internet browsing and reduce load on DNS servers. The validity of these files I specified by something called Time To Live (TTL). As long as the time period is within this TTL the cache files will be used without having to go to the DNS server.

It is possible though, that DNS cache files might get corrupt or outdated. It is highly recommended to flush your DNS cache regularly.

DNS data might change, and this will lead to issues while browsing. Another reason to flush DNS records is when you change DNS service providers. This will enable much more accurate and better browsing. There is more than one DNS provider apart from that of your ISP’s that give good lookups and you might consider something like Google’s DNS service or Open DNS or something like Cloudflare’s DNS service to help. If you switch DNS service providers, you should look at flushing your DNS records as that will help.

Here are three advantages of clearing your DNS cache

1. Improves your privacy on search engines:

Storing DNS records and reading them, helps hackers have access to your browser history. The DNS cache records every website that your computer visits. This means that websites with confidential information can be traced using the DNS cache. By clearing cache, you clear any record of visiting websites like those.

2. Improve security on browsers:

DNS cache files can be misused for DNS spoofing, and therefore putting user sensitive information at risk. Anyone with access to your computer can just run a command “ipconfig /displaydns” and view every entry in your cache, displaying what websites are being used. Clearing your cache can be a step in protecting your privacy and the data on your computer.

3. Reduce technical issues:

Updating your DNS records is an easy way of fixing common issues that might occur with corrupted cache files. In fact, it can help fix incorrectly displayed web content. Clearing the cache can also save space on a computer. This helps prevent 404 errors while visiting older websites.

Steps to flush your DNS cache

Each operating system has its own way of flushing the DNS cache. The steps below will show you how to do it on windows, Linux, and Mac OS X.

Microsoft Windows

The following tutorial is applicable for Windows XP, 7, Vista, 8, 8.1, and 10.

  1. Press Windows+R keys together to open Windows command prompt console, then enter cmd.
  2. Type the following command to clear DNS cache files on your computer: ipconfig /flushdns.


Most of the popular Linux distributions do not cache DNS records. But if the user installs a DNS service like a name service caching daemon (nscd). Then the following steps will help in flushing the DNS cache.

  1. Open a terminal window or Press Ctrl+Alt+T keys together to open the terminal window.
  2. Enter the following commands to clear DNS on the init.d subdirectory:   sudo /etc/init.d/nscd restart

Mac OS X

  1. Press the F4 key, then enter terminal in the Launchpad’s search field to open the terminal window.
  2. If you’re using Mac OS Sierra, X El Capitan, X Mavericks, X Mountain Lion, or X Lion, enter the following command: sudo killall -HUP mdnsresponder
  3. To flush DNS cache on Mac OS X Yosemite, enter the statement: sudo discoveryutil udnsflushcaches
  4. If you’re running on Mac OS X Snow Leopard, use the command: sudo dscacheutil -flushcache
  5. For Mac OS X Leopard and below, enter the following command to flush DNS cache: sudo lookupd -flushcache


If the content you are looking for on a website seems to be displayed incorrectly, chances are your DNS cache might be corrupted or outdated. A quick DNS flush can be the solution you need.