In most cases, your operating system is capable enough to handle troubleshooting processes on its own. But sometimes, you need to get involved in some manual maintenance which in this case is to clear DNS cache.
Fortunately, you can Google pretty much anything these days, and your OS and browsers use a system to make this process faster. How?
Say, every time you run into a software problem on your Windows computer, you visit Microsoft Support; this website becomes one of your most visited websites. Your operating system and browser pick up on this and use a tool called DNS (Domain Name System) cache to optimize your web experience and save network resources.
However, every system might experience downtime or errors due to technical glitches or other issues, and when the problem persists, you need to tap into your technical knowledge or ask for help to solve the issue.
A poisoned or corrupted DNS cache is the problem we’re talking about in this context, and the purpose of this article is to teach you how to deal with it.
Let’s get clear on the basics before we discuss why you need to clear DNS cache and how.
What is DNS Cache & How Does It work?
Let’s divide this section into three parts: DNS, cache, and DNS cache.
What is DNS?
DNS is short for the Domain Name System, which is in charge of translating domain names, such as Cloudzy.com or Amazon.com, to readable IP addresses by the browsers. DNS is like an online phonebook; you’ve got the name of the website you want to visit, and DNS has its number.
Why is DNS necessary? Because each domain name is inaccessible without its IP address. Think of DNS as a system that puts a pin on every hostname. When users search for a hostname, DNS uses those assigned pins to find the location of that hostname so it can direct users to their website.
What is Cache?
Cache refers to information or data on hold; you can access it much faster because it is already loaded.
What is DNS Cache?
Say you visit Amazon every day to scroll through your favorite digital products. These frequently-visited Amazon IP addresses and their information is saved in a database called DNS cache. Every IP address stored in your DNS cache will reload faster the next time you search for it.
The DNS cache process is the same for all your most visited websites, and the whole point of this process is to improve the loading speed of these websites. So if DNS caching enables users to access websites faster, why do you need to clear DNS cache every once in a while?
Why Do You Need to Clear DNS Cache?
DNS is home to many IP addresses but are all of them safe? And even if they are, can their existence in your DNS cache cause problems?
Here are the reasons you should clear DNS cache regularly:
- Some IP addresses are dangerous or corrupted and can cause security and performance issues and decrease network speed and connectivity.
- Your DNS cache contains all the IP addresses you visited, which acts as a beacon for DNS spoofing. If cyber crooks find a way to access your DNS cache, they can alter stored IP addresses to redirect you to malicious or fraudulent web pages. (The best way to prevent this from happening is to execute a clear DNS cache command.)
- Advertising companies operate on studying user behaviors, and aside from cookies and third-party plugins, your DNS cache is a great source of your online behavior. Think of your search history. Would you like cyber criminals or big corporations to see your search history? Of course not. Your search history is like your private closet, and some skeletons might be hidden there. Your DNS cache is kind of the same thing, so you need to protect it from prying eyes.
- Sometimes you might have trouble accessing a website you frequently visit; it might not load or show you an error every time you click on its link. Both cases relate to the DNS cache. If you see a 404 error when you search an IP address, its domain name or host might have been changed, and your DNS cache is loading its old or outdated information. The second scenario was when the website you visit often doesn’t load, and you’ve already cleared cookie and third-party integrations; the extra loaded DNS cache is the problem.
When your phone acts up, you immediately go for the restart button, and nine out of ten times, the problem is solved. The clear DNS cache command is the restart button of your OS.
How to Clear DNS Cache on Different Operating Systems?
The flush DNS command varies based on your operating system and its version.
Flush DNS Command for Windows
Follow the steps below to clear DNS cache on Windows 11, 10, 8, 7, and XP.
Steps to Flush DNS on Windows 10/11:
- Click on the Start button and type cmd in the search bar.
- Click on Command Prompt and type in the following command:
- You can close the Command Prompt window after seeing the below message:
Successfully flushed the DNS Resolver cache.
Steps to Flush DNS on Windows 8/7/XP:
The flush DNS command for Windows 8, 7, and XP is the same as for Windows 10 and 11. The only step that varies is finding the Command Prompt window.
- In Windows 8, you can open the Command Prompt window in two ways:
- Hold the WIN and X keys together and click on Command Prompt.
- Click on the Start button, open the Apps screen, click on Windows System, and select Command Prompt.
- If your OS is Windows 7, or XP, here’s how you can find the Command Prompt window:
Click on the Start button, hover your cursor over All Programs, select Accessories, and find Command Prompt.
Flush DNS Command for Linux
The flush DNS command varies for different Linux distributions.
Steps to execute Ubuntu flush DNS cmd:
Click on Activities from the top-left corner of your desktop.
Type Terminal in the search bar, click on it, and type the below commands:
sudo systemd-resolve --flush-caches
sudo systemd-resolve --statistics
To enable new DNS configuration, you need to execute the following command to restart DNS service in Ubuntu:
sudo systemctl restart bind9.service
Steps to execute flush DNS cmd on Red Hat & CentOS:
Type Terminal in the desktop’s search bar, click on it, and type the below command based on your Linux-based OS:
sudo systemctl restart nscd.service
systemctl restart dnsmasq.service
Flush DNS Command for macOS
The flush DNS cmd for macOS 10.7 to 10.9, 10.11, or above is the same; follow the steps below:
From the top menu of your mac device, click on Go, find Utilities, and select Terminal.
Now type the below command to flush DNS on mac. (You need to input your device’s password after typing the command):
sudo killall -HUP mDNSResponder
To flush DNS on macOS 10.10, 10.6, or 10.5, follow the previous steps to find the Terminal and type the below commands:
Flush DNS cmd for macOS 10.10:
sudo discoveryutil udnsflushcaches
Flush DNS cmd for macOS 10.6:
sudo dscacheutil -flushcache
Flush DNS cmd for macOS 10.5:
sudo lookupd -flushcache
How to Clear DNS Cache on Google Chrome
If you have followed through the steps to clear DNS cache on your OS and still experience website loading or other performance issues, it’s time to execute the Chrome clear DNS cache command; follow these steps:
- Step 1:
Launch Google Chrome.
- Step 2:
Search the following IP in Chrome’s address bar:
- Step 3:
Select DNS from the list.
- Step 4:
Click on Clear host cache.
What does DNS mean?
DNS stands for Domain Name System, which is an online system that directs you to the location of the website you want to visit_its IP address_ based on the domain name you entered in your browser’s search tab. (Domain name is the name of the website you search for, such as Cloudzy.com).
Why should I clear DNS cache?
If your OS is performing slower than it used to, or you constantly run into search errors such as 400 (Bad Request), 401 (Unauthorized), and 404 (Not Found), flushing your DNS cache might fix these problems.
What happens if I flush my DNS?
All the saved IP addresses of the websites you visited will be gone, and after that, when you search for a website, your operating system must retrieve its location_IP address_ from the DNS server.
What does Chrome clear DNS cache command do?
It removes all IP addresses and DNS information from your browser, improving Internet connectivity and preventing security issues.
Is it safe to delete DNS cache?
Yes. DNS cache is just an online space that stores websites’ IP addresses so you can access them faster. Flushing DNS cache empties this online space, that’s all.
How often should I flush my DNS?
If you use a public computer and don’t want anyone to spy on your search history, it’s best to flush DNS cache after each online session. For your personal computer, aim to clear DNS cache when you have trouble accessing your frequently visited websites or see 404 errors quite often.
Does executing the flush DNS Windows 10 command improve Internet speed?
No. But you can use the flush DNS Windows 10 command to speed up your web browser performance. Doing so will affect the loading speed of certain websites and services.
How to know when I should clear DNS cache on my device?
Here are the signs telling you to clear DNS cache:
- Not seeing new and updated versions of websites (Their old address is stored in DNS cache, and that’s the one your browser loads.)
- Not being able to access your most visited websites (They might have changed servers or updated their DNS configuration)
- 404 page not found errors
Also Read: Best DNS Servers for Gaming
Every time you search for a website, you need its IP address to access it; DNS’s job is to fetch that IP address. After DNS retrieves each IP address, it stores it in a space that can be accessed by your browser for faster loading; DNS cache.
What happens over time is that, like every other storage space that needs decluttering, the DNS cache needs it too. You need to clear DNS cache once in a while to protect your OS from malware, viruses, cyber snoopers, and other types of online threats and also experience faster web searching.