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.
- In the opened Command Prompt window, type in this command and hit Enter:
ipconfig /flushdns
- If successful, you will see a message stating “Successfully flushed the DNS Resolver Cache.”
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.
- 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.
- 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
- Open a terminal window. You can usually do this by pressing
- 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:
sudo resolvectl flush-caches
If successful, you won’t see any confirmation message, but your DNS cache will be flushed.
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.
How to Flush DNS Cache [Windows, Mac, and Linux]
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.
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.