Google Chrome is the #1 web browser globally today, preferred for desktops, laptops, Android devices, and even on a Mac OS.
Its market share is over 60% per the latest industry reports, followed only by Safari, the default Mac browser.
Known for its focus on security and productivity, Google Chrome also has its own DNS and caching system for higher speeds.
What is DNS Cache? Why do you need to flush it?
DNS cache refers to the data the browser stores about websites you visit frequently.
DNS or Domain Name System cache records all the browser queries, asking for the IP address of a URL from a DNS server.
This cache speeds up your browsing experience by reducing the server response and resolution time. You can also access the website when the ISP server is down.
However, these records are not usually permanent, as a website may change its DNS entry.
You may not be led to the correct IP address until your DNS cache data is refreshed. You may be unable to access the website. It can happen frequently in today’s fluid internet era, when new servers get added regularly, and older ones go through decommissioning.
Another scenario requiring you to clear this cache is while resolving a faulty network condition. Flushing is necessary after changing the DNS servers of the network adapter.
Occasionally, you may get repeated error messages claiming your commonly accessed websites are untrusted. Once you have cleared the cache, the browser will update the repository with fresh data from the website.
Steps to Clear DNS Cache on Google Chrome
1. Clear directly from the browser
You can take three simple steps to flush out the DNS Cache on the browser.
- Open a fresh tab.
- Type this URL: chrome://net-internals/#dns
- Press the “Clear host cache” button.
“net-internals/#dns” is a NetLog visualization tool for viewing browser events, troubleshooting, and debugging. It is also called Net-Internals. You can see a complete list of hosts in the cache.
Further, follow the below steps to clear out socket pools. A socket pool boosts security against cache poisoning by letting the DNS server use source port randomization. It also protects you from DNS spoofing.
- Open a new tab.
- Type this URL: chrome://net-internals/#sockets
- Press the “Flush socket pools” button.
Clearing the DNS cache can take up to 15 minutes. You must restart your browser after completing these steps. This approach also works if you use Google Chrome on Android devices.
2. Clear from the Terminal
You can also clear the DNS cache from the Terminal. It involves only one step after you open the console.
Windows:
- Open the Terminal (Admin).
- Type this command:
ipconfig /flushdns
Linux:
- Open the terminal.
- Type this service or systemctl command:
sudo service network-manager restart
Mac OS:
- Open the terminal.
- Type this command:
sudo dscacheutil -flushcache
sudo killall -HUP mDNSResponder
How can you be sure that the DNS Cache has been cleared?
It might be possible the commands didn’t work as expected due to a network error. Moreover, your browser may not show any confirmation message after you have performed the necessary steps for DNS flushing. I recommend ensuring the success of the flushing exercise by running the following commands specific to your operating system:
- Open the Terminal.
- For Windows, Linux, macOS, or Unix: Type nslookup <website name>
- Users of Unix, macOS, and Linux can also type host <website name> or dig <website name>
Does the DNS Cache flush automatically?
Yes. The cache will clear itself even if you don’t initiate any action after the TTL — time to live in seconds – expires. However, for the security reasons I discussed, it might be necessary to clear it before this period.
Typically, Google Chrome caches the DNS information for one minute (60 seconds). It can store as many as 1,000 records.
Caution
Clearing your DNS cache can interfere with the cookies and sessions set up by some web pages. Some users get a warning that this action ‘may break pages with active connections.’ So, you may need to enter your user credentials again at some portals, like online banking.
Also, flushing the DNS cache does not impact your browsing history. So, all your passwords or auto-fill information will remain unaffected. You must clear browsing data from privacy settings to erase cookies, viewing history, etc.
You should now be able to clear the DNS cache without any hassle. I recommend doing this frequently — as often as needed — to keep your system safe from phishing attacks and ensure you visit the most updated versions of your favorite websites.