Open In App

How to Flush DNS Cache [Windows, Mac, and Linux]

Last Updated : 04 Apr, 2024
Improve
Improve
Like Article
Like
Save
Share
Report

Among the reasons for the internet’s success is its efficiency, and a vital element here is the Domain Name System (DNS) cache. Understand DNS as a big phone book that turns web addresses such as www.example.com into numeric IP addresses that computers can process. Your device stores frequently accessed translations in a DNS cache, similar to how your browser remembers recently visited websites. Through this cache, you can continuously search for the same information without waiting.

How to Flush DNS Cache [Mac Windows and Linux]

However, there are times when this cache can become outdated or corrupted, leading to website loading issues or even accidentally directing you to malicious sites. This calls for the flushing of the DNS cache. To be specific, clearing these stored translations out of your computer simply means resetting it so that it will ask for fresh IP addresses from the DNS server whenever you open any site again.

This article takes a look at how one can flush their DNS caches on Mac, Windows, and Linux operating systems. Additionally, we will also discuss some typical instances where flushing the DNS cache may prove useful.

What are the Signs You Should Flush Your DNS Cache?

Although the DNS cache is generally good, sometimes it may be worthwhile to flush the DNS cache to fix browsing issues. Some of the indicators of such situations are as follows:

  • Websites fail to fully load: In case you encounter error messages like “This site can’t be reached” or see a website that looks outdated despite being updated elsewhere, this is an indication that your DNS cache may have been corrupted.
  • Your internet service provider has changed: If you just recently switched ISPs and your DNS cache still references the old DNS servers. Clearing the cache will ensure that you are using the new servers which are accurate.
  • You believe you’ve stumbled upon a phishing site: Phishing websites normally copy real sites. Deleting all cookies as well as clearing any other traces of these mentioned above will help in preventing users from getting redirected towards harmful duplicates and thereby remaining safe forever. But remember, when it comes to web things one can never be too cautious.

How to Flush DNS Cache?

However, clearing your DNS cache is simple but will differ depending on your operating system (OS) and whether you are doing it from your computer or browser. In the following sections, we shall detail how to clear the DNS cache for macOS, Windows, and Linux.

1. Flushing the DNS Cache on Windows

Flushing the DNS cache on Windows involves using the Command Prompt:

  • Press Win + R to open the Command Prompt, type cmd, and hit Enter.

Windows-Flush-DNS-01

  • In the opened Command Prompt window, type in this command and hit Enter:
ipconfig /flushdns

Windows-Flush-DNS-02

  • If successful, you will see a message stating “Successfully flushed the DNS Resolver Cache.”

Windows-Flush-DNS-03

2. Flushing the DNS Cache on Mac

Here’s how to flush the DNS cache on your Mac:

  • Press the F4 button to open Spotlight.
  • A search bar will appear; type “Terminal” and click to open it.

MacBook-Flush-DNS

  • Enter the following command and press Enter:
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
  • Type your administrator password when prompted. This is required to run commands with administrative privileges.

MacBook-FlushDNS-2

  • Press Enter again. If successful, you won’t see any confirmation message, but your DNS cache will be flushed.

3. Flushing the DNS Cache on Linux

The specific commands for flushing the DNS cache on Linux can vary depending on your distribution. Here are some common methods:

For Ubuntu and Debian

  1. Open a terminal window. You can usually do this by pressing
  2. Type the following command and press Enter:
sudo systemd-resolve --flush-caches

For newer versions of Ubuntu

You may need to use this command instead:

Linux-Flush-DNS

sudo resolvectl flush-caches

If successful, you won’t see any confirmation message, but your DNS cache will be flushed.

Linux-Flush-DNS-2

Other Distribution

Here are some examples of other Linux distributions:

  • Fedora/CentOS
sudo service nscd restart
  • Arch Linux
sudo systemd-resolve --flush-caches

Important Note: The above examples are just a few of many possible “sudo systemd-resolve –flush-caches,” and yours might differ. For more accurate instructions, consult your distribution’s documentation.

Once you clear the DNS cache, there may be some slight latency when first visiting web pages. This is because your device has to obtain fresh IP addresses from the DNS server. This delay should be minimal, and subsequent visits to the same website should load at the usual speed.

When Flushing the DNS Cache Might Not Help

This DNS (Domain Name System) cache flushing is not a magic bullet for all internet connectivity problems that affect your computer. Here are some scenarios where it might not be the solution:

  • Hardware or software problems: If you frequently get disconnected, have a slow internet overall or specific devices experience issues it could mean your hardware, internet connection or software.
  • Website downtime: If the website you are attempting to open is actually down for maintenance or have technical issues then clearing your DNS cache will not just make it appear.
  • Incorrect network configuration: Check again if your network settings are set up properly in regard to your ISP (Internet Service Provider).

Conclusion

Although simple, flushing the DNS cache is an effective way of resolving website loading issues. Consequently, it takes a few steps to wipe out the possibly outdated cached data and make sure the device gets the most recent IP addresses of sites visited by users. It is also important to note that flushing DNS cache is merely one tool among others employed in troubleshooting internet connection problems and thus if you still have internet challenges you should try other remedies.

Must Read:

FAQs on How to Flush DNS Cache? [Windows, Mac, and Linux]

What is the DNS cache, and why should I flush it?

The DNS cache stores translations of website names, such as [www.example.com], into numbers called IP addresses on your computer. This cache speeds up browsing by readily providing IP addresses for websites you’ve visited before. However, outdated entries in the cache can lead to website loading issues. Flushing the cache clears out this data, forcing your device to obtain fresh IP addresses, potentially resolving website connectivity problems.

How often should I flush my DNS cache?

Flushing of DNS Cache depends on how often one wants to accomplish this task while using their computers or any other devices. For instance, if your device cannot open some websites, has slow browsing speeds, or is suspicion about a phishing site then cleaning the DNS cache can be helpful.

Will flushing the DNS cache erase my browsing history?

No, only the temporary database of web address translations is cleared when flushing the DNS cache. Your browsing record will not be affected at all since cookies and other browsing activities are stored in different sections of your browser. Blockquote

Is flushing the DNS cache safe?

Yes, flushing the DNS cache is a safe and common troubleshooting technique. It simply clears out temporary data and doesn’t affect your device or personal information.



Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads