As you probably know Google Chrome has its own internal DNS cache. Is there a way to clear it without having to wait for the time out or close the browser?
"Navigate to chrome://net-internals/#dns" doesn't work in the Google Chrome browser, at least on my system. Looks like this solution maybe works for the Google Chrome OS, but not the Google Chrome browser more generally speaking. For me the link redirects here:
The Chromium Projects
It appears "Empty the Cache" is the better solution. Also note my browser says "Preferences" rather than "Options"
"Go to tools -> options -> Under the hood -> Clear Browsing data and check 'empty the cache' and click on clear browsing data. Yes yes, I know, it is not the DNS cache I would expect it to clear, but hey it seems to. And now it works for me."
Clicking "clear host cache" in
chrome://net-internals/#dns should do it for Google Chrome, but there are other DNS caches to consider on your machine.
OS X pre-10.7 (before Lion):
sudo dscacheutil -flushcache
OS X 10.7–10.9 (Lion, Mountain Lion, Mavericks):
sudo killall -HUP mDNSResponder
OS X 10.10+ (Yosemite):
sudo discoveryutil mdnsflushcache
OS X 10.11, 10.12+ (El Capitan, Sierra):
sudo killall -HUP mDNSResponder
Your router may be caching the DNS as well (restart it or read the manual). The ultimate test is to use dig, but this uses your network's DNS host, not the authoritative server by default:
To query right from the source, try something like:
dig superuser.com @ns1.serverfault.com
This worked for me: Empty and clear the disk cache
In Chrome, click on the wrench icon, and then Options. Go to Under the Hood tab. Click on the Clear browsing data button under the Privacy section. Select just the "Empty the cache" check box, and then click on the Clear browsing data button.
This worked immediately - I didn't even have to close the browser.
As far as I can find, in recent versions of Chrome (I'm on 26.0.1410.43), there's no (reliable) way to do it, at least not on a Mac. None of the suggestions on this page have worked for me.
My situation is that I've added a hosts file entry, but Chrome is still going to the IP address returned by DNS. Firefox works correctly.
In fact, the
chrome://net-internals/#dns page is simply lying about the IP address for me. It shows the IP from the hosts entry, but that is clearly not where it's actually getting the site from.
I know this is an old question but I got annoyed by same the complaints as others: even after clearing the cache it can still take a minute or two for the new DNS changes to kick in.
There are a few ways around it. After clearing the DNS cache through chrome://net-internals/#dns (or using an extension that achieves the same result):
Open an incognito window and the new DNS mappings for the domain will be effective immediately.
Clear the browser cache. This is cumbersome if you use your browser for regular browsing. You can run a separate instance of the browser as another user and clearing the cache in that account will not interfere with your regular browsing cache. I haven't tried this but it should work.
Hit CTRL+F5. I had to keep CTRL+F5 pressed for about one second which consecutively reloads the page a couple of times. This is odd behavior but it works and is also just as effective. This is my preferred approach.
Ideally there ought be a plugin that can purge the DNS and cache (specifically just the document cache and not the cookie cache) but I didn't find anything of the sort yet.
UPDATE: On OSX the Gas Mask application is excelling for switching between hosts files and along with the #2 workaround, it's quite effective.
It is to resolve the problem that Chrome can't use the correct hosts after modifying the hosts file because of Chrome using socket pools.
Chrome maintains long connections in the connection pool to speed up. When Chrome finds that a request can reuse a connection in the connection pool, it won't go through the DNS again, thus, we always perceive that Chrome won't respond to a hosts change immediately.
Chrome has provided an interface for flushing the connection pool in the chrome://net-internals/#sockets tab, but I think it's annoying that I have to go to the tab first, and click so a small button with a trackpad.
So I encapsulate these two methods in an AppleScript script which can be converted to an OS X application or Alfred workflow which both can be invoked easily.
5 years later...
Chrome now has an option to disable cache.
- Press F12 (or Ctrl+Shift+I) to call up the DevTools.
- Go to Network Tab
- Check the "Disable Cache" box.
- Reload the page
- Right-click the reload button so that the menu opens. Select “Empty Cache and Hard Reload”.
- Enable cache in DevTools.
This also solves the redirect cache (chrome caches permanent redirects)
I tried to flush the DNS cache in so many ways, but nothing worked for me. At last, I planned to change my DNS entry. This trick will work for all people who access Internet through high speed LAN connection.
On a LAN connection, a user is generally provided two DNS addresses. One is primary and another is secondary or alternative DNS address. What I did was that I just changed the secondary address to the primary address and vice-versa. It worked for me instantly.
I kept the alternative DNS address as primary address for two days. The problem solved itself and later, I reinstated the old DNS entry.
Created site in IIS (windows 8), set host header.
Tried hitting the the host with no host file, ensuring to use http:// so it does not just do a google search. Correctly failed in chrome "Version 32.0.1700.76 m"
Add host to host file as 127.0.0.1, now can hit it in chrome.
Remove from host file and run ipconfig /flushdns, chrome still shows site!
Do nothing other than CTRL+F5 and now site correct fails in Chrome.
With the number of different answers here I wonder if we all have slightly different use cases.
For iPhone users, these techniques work just as effectively. I had to do some testing of a website, and I wanted to override the normal DNS server and use my own DNS server with DNS entries that are not yet public.
I override the DNS entry in my wifi setting on my iPhone 6 Plus to my custom DNS server. That was good enough for Safari and Perfect Browser. But Chrome seemed to ignore that and had its own set of DNS entries. I could NOT figure out where they came from.
I did what they described above
- Navigate to chrome://net-internals/#dns and click "Clear Host Cache"
- Navigate to chrome://net-internals/#sockets abd click "Flush Socket Pools"
AND I had to also Use an InCognito Tab as mentioned above.
Only THEN did Chrome use my custom DNS entry.
Try DNS Flusher for Chrome. Note that to use it, it requires a command line flag,
--enable-benchmarking when you start the Chrome browser.
On Mac OS X, none of the above mentioned approaches worked for me. The following approach did:
Click Chrome menu > preferences > click the link
show advanced settings in the bottom of the page > click
clear browsing data button in
privacy section > only select
cached images and files and
download history (perhaps the later isn't required, but doesn't hurt either) > click
clear browsing data button.