How to clear/flush the DNS cache in Google Chrome?

926

292

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?

Mee

Posted 2010-10-26T21:12:00.193

Reputation: 9 388

The only reason for me to flush Chrome's DNS cache is because if I don't, I can't access Google. Luckily, Google's not the only search engine out there (or else I wouldn't have found this question) and I only have to deal with Chrome at work. – Nolonar – 2013-04-11T09:16:04.700

For me, this is probably caused by having an incorrect DNS-server in resolv.conf. (I am trying to access an internal server on a VPN). The people at T-com have misconfigured their DNS to respond with their advertisement site instead of NXDOMAIN, and the people who wrote Chrome didn't care to respect the resolv.conf order, but instead happily use whatever DNS server appears to work. – Ketil – 2014-02-21T02:32:02.233

Answers

1 346

Navigate to chrome://net-internals/#dns and press the "Clear host cache" button.

ephemient

Posted 2010-10-26T21:12:00.193

Reputation: 20 750

@AdamTal, Actually if you update your hosts file, the dns cache service will reload itself. See http://superuser.com/questions/203674/how-to-clear-flush-the-dns-cache-in-google-chrome#comment1272351_611712 for more info.

– Pacerier – 2015-07-06T13:00:24.760

2

This does not work on Chrome for linux. But just a socket flush works. http://superuser.com/a/611712/30982

– Elijah Lynn – 2016-02-05T17:05:36.160

42Strangely, this only works in one direction. I have a mapping in the hosts file that maps a domain name to the local machine (i.e. to 127.0.0.1), when I remove the mapping and flush the DNS cache in Chrome, it correctly loads the site from the internet, but when I add the mapping again to the hosts file, it still loads the site from the internet. It shows the cached DNS list empty in Chrome after clearing the DNS cache (also cleared the OS cache using ipconfig /flushdns), still, it loads the site from the internet! Seems like a bug. – Mee – 2010-10-28T02:14:10.820

10Even more annoying, Chrome shows the IP address correctly (127.0.0.1) for that domain in the DNS cache list (after flushing and trying to load the site again), still it loads the site from the internet. – Mee – 2010-10-28T02:15:01.863

On Firefox my local page works just fine. On Chrome it still loads online resource. And I've tried every single answer here. This is just ridculous! Because of the MANY things like this one I like Firefox better. Chrome is bad for my health! – Sharak – 2019-01-25T18:02:29.200

It works, thank you. Just want to add that also need to restart the browser. – Nickolay Kondratenko – 2019-09-29T07:59:35.193

4awesome, is there a list of all the chrome://* options anyway does anyone know? – Ian – 2011-05-13T09:18:13.650

30@Ian chrome://about – ephemient – 2011-09-24T18:47:01.953

For copy and paste into address bar: chrome://net-internals/#dns – chakrit – 2012-01-20T09:55:37.133

this does not work for all addresses. the answer given below (preferences; clear browsing data) does. due to the strange way my cable modem powers up chrome had cached the dns for my isp as "news.bbc.co.uk" (the modem sends you to the isp before it's fully up). following the above did not remove it. going via the preferences did. – andrew cooke – 2012-02-01T00:11:32.033

@Mee Restarting System's "DNS Client" Service from Services.msc might help. – Ujjwal Singh – 2012-12-17T20:08:38.983

Interesting note: if you have clicked the 'Stop' button in the red title bar, the 'Clear host cache' button will disappear. In any case this approach does not appear to actually clear the DNS cache. – Air – 2012-12-29T23:02:46.427

4This seems to only work sometimes when you have multiple user profiles. Chrome is almost the perfect developers browser except for bugs like this. – Rob Osborne – 2013-01-30T01:00:09.103

3This didn't work for me. Emptying the cache (as the second answer suggests) did. – Martin Argerami – 2013-09-06T07:39:47.460

This worked...except when I went to incognito. I just couldn't figure out why that wasn't working. – Paul Draper – 2013-11-05T06:08:36.137

1Doing this and then going to the website and pressing shift+f5 3 times worked for me! Didn't work without using shift+f5 3 times though. – daboross – 2014-01-29T23:22:15.080

10Wasn't enough for me. Had to "ipconfig /flushdns" in command prompt (found in answer below) – Adam Tal – 2014-05-27T21:47:50.090

182

Sometimes you need to flush the socket pools after flushing the DNS:

chrome://net-internals/#sockets

Bojan Hrnkas

Posted 2010-10-26T21:12:00.193

Reputation: 2 072

4Note that Chrome now monitors the hosts file and autoclears the dnscache whenever there are any changes to the hosts file. —You can easily test if that works on your system by adding a blank line after your hosts file, and the list at chrome://net-internals/#dns will be autoupdated.— Windows' dnscache service will also (at least on win 8.1) monitor the hosts file for changes, so after you have updated your hosts file, simply clicking on the button "Flush socket pools" will work. Nothing else is needed. – Pacerier – 2015-05-21T06:02:44.247

Yeah, I seem to have noticed the same behavior since 1 year or so. However, maybe it doesn't work all the time, for I still get the upvotes on this answer. – Bojan Hrnkas – 2015-05-21T06:45:47.410

Just tested on Server 2003 too. Whenever there are any changes to the hosts file, dnscache service automatically reloads the cache without any need for ipconfig /flushdns nonsense. ipconfig /flushdns seems to be a red herring in this entire issue. – Pacerier – 2015-07-06T12:57:57.090

Worked for me, even after flushing dns in cmd and doing the accepted answer – Rob Scott – 2015-12-03T14:43:39.510

Awesome, this is the only solution that works on Chrome for Linux (Ubuntu 14.04). In fact a DNS flush doesn't affect anything. All that is needed is to do a socket flush. I consider this a bug. – Elijah Lynn – 2016-02-05T17:06:37.013

Just went to report a bug and did a search... already exists. Please star/follow this bug report => https://code.google.com/p/chromium/issues/detail?id=268059

– Elijah Lynn – 2016-02-05T17:10:17.900

1No longer works. – Hippyjim – 2018-01-17T21:33:23.817

@Hippyjim, it never worked alone. You also have to clear DNS (chrome://net-internals/#dns). My answer is only usefull when clearing DNS alone doesn't work. – Bojan Hrnkas – 2018-01-18T14:39:53.113

Yeah, I did both. Still nothing. Thanks anyway. I'm working around it by using an Incognito window - which makes absolutely no sense! – Hippyjim – 2018-01-19T15:28:56.963

Now I wish for a way to do this on command line along with my other stuff to flush DNS cache. – Tatsh – 2018-07-15T06:33:32.300

This worked for me when the DNS flush didn't, 2019 -- Chrome Version 77.0.3865.120 – Albert Renshaw – 2019-10-21T19:22:26.500

54

"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"

Via http://www.google.com/support/forum/p/Chrome/thread?tid=026b6a1d9151a6e3&hl=en

"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."

PJ Brunet

Posted 2010-10-26T21:12:00.193

Reputation: 1 044

3Clearing Cached images and files worked for me! No clue why, but it did. Windows 8.1, Chrome 41.0.2272.89 m – Bing – 2015-03-29T18:53:12.187

clearing cached images and files worked for me too - nothing else did – byronyasgur – 2018-04-13T15:29:37.100

Windows 10, Chrome 79+ : chrome://settings/clearBrowserData : General tab, tick Images and Files checkbox. Done. – Cédric Françoys – 2020-02-20T19:35:06.400

6Confirmed this worked for me, Clear Browsing Data -> Empty the cache. No other method worked. Thanks PJ. – Air – 2012-12-29T23:04:02.140

This worked for me on both chrome and chromium when /etc/resolver/foo.com was being ignored. – chovy – 2013-09-17T03:31:10.727

Looks like Google is gradually making name changes to some internal URLs over different versions. As of version 27.0.1421.0 (184274)... – DocSalvager – 2014-01-16T10:25:33.150

At least clearing Cached images and files did not work for me (Chromium 33 on Ubuntu) after turning on OpenVPN and thus switching my active DNS server. (Clear host cache as in the popular answer did not work either.) So far I have not found anything that works except restarting the browser, or entering the IP address in the URL. – Jesse Glick – 2014-04-18T13:46:52.360

43

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.

Windows:

ipconfig /flushdns

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:

dig superuser.com

To query right from the source, try something like:

dig superuser.com @ns1.serverfault.com

Johntron

Posted 2010-10-26T21:12:00.193

Reputation: 564

1"sudo discoveryutil mdnsflushcache" didn't work on El Capitan (10.11) for me, but "sudo killall -HUP mDNSResponder" did, it said that discoveryutil did not exist, maybe it's Sierra and up? – Ezra – 2016-11-02T11:41:26.150

20

In OS X 10.9.1 w/ Chrome 32 I needed to both clear the host cache and flush the socket pools to get Chrome to refresh the DNS cache:

  1. Navigate to chrome://net-internals/#dns and click "Clear Host Cache"
  2. Navigate to chrome://net-internals/#sockets abd click "Flush Socket Pools"

Sina

Posted 2010-10-26T21:12:00.193

Reputation: 301

I needed it in Windows 8.1 as well, so it's not just OS X. – benrick – 2014-07-14T02:34:12.147

Chrome for Linux also need it chrome://net-internals/#sockets – pengemizt – 2014-12-17T11:51:09.330

Chrome for Linux just needs a socket flush. No DNS flush. http://superuser.com/a/611712/30982

– Elijah Lynn – 2016-02-05T17:04:58.917

18

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.

Josh

Posted 2010-10-26T21:12:00.193

Reputation: 189

1This seems to work to force Chrome to recognize changes to the hosts file. – minamhere – 2012-06-26T02:39:40.580

This worked for me on Mac Chrome, after having tried the chrome://net-internals/#dns flush trick mentioned here, without success. – Markus Amalthea Magnuson – 2014-03-10T20:16:42.927

14

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.

Stu

Posted 2010-10-26T21:12:00.193

Reputation: 633

2Same problem here. I have tried clearing cache, clearing the internal DNS cache, ipconfig flush dns, and it is still loading a local website from the live domain. If I open it in "Incognito" it works, or in Firefox it works, but normal Chrome refuses to reset its DNS – andrewtweber – 2013-04-23T14:43:51.160

9

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):

  1. Open an incognito window and the new DNS mappings for the domain will be effective immediately.

  2. 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.

  3. 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.

aleemb

Posted 2010-10-26T21:12:00.193

Reputation: 363

1

Refreshing will not help one bit. The active TCP sockets will still be active. You either wait it out (1-2 minutes) or manually flush them.

– Pacerier – 2015-05-21T06:23:29.337

6

Chrome_Hosts_Flush_Util:

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.

I found that when clicking the button of flush socket pool, Chrome executes two key JavaScript methods.

g_browser.sendFlushSocketPools();
g_browser.checkForUpdatedInfo(false);

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.

Boreas320

Posted 2010-10-26T21:12:00.193

Reputation: 161

Hi Boreas320, can you provide a summary of what your link provides in your answer in case it becomes out of date? Answers that are only/mostly a link are discouraged as they can go stale. – bertieb – 2015-08-03T12:41:25.200

Up! Wonderful idea! Thanks! However it didn't work for me until I replaced the javascript with document.getElementById('sockets-view-flush-button').click(); – i_a – 2017-06-22T21:11:18.363

5

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.

Som

Posted 2010-10-26T21:12:00.193

Reputation: 51

5

Full process:

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.

rob

Posted 2010-10-26T21:12:00.193

Reputation: 575

4

For me private browsing did the trick (New incognito window/ private window).

Bart Broekhuizen

Posted 2010-10-26T21:12:00.193

Reputation: 41

Hi Bart, welcome to Superuser! Unfortunately, this question is about the computer-version of Chrome, not the mobile version. I'd suggest [edit]ing your answer to reflect the desktop version. Thanks – Canadian Luke – 2014-02-21T02:35:31.360

2

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.

Javad Sadeqzadeh

Posted 2010-10-26T21:12:00.193

Reputation: 131

2

Try DNS Flusher for Chrome. Note that to use it, it requires a command line flag, --enable-benchmarking when you start the Chrome browser.

Sway Deng

Posted 2010-10-26T21:12:00.193

Reputation: 39

extension no longer exists – jmgarnier – 2019-04-01T08:47:43.510

2

Navigate to chrome://net-internals/#dns and press the "Clear host cache" button. as answered already Also you may need dscacheutil -flushcache command in OS X, to flush system-wide DNS cache. ipconfig /flushdns in windows command prompt

Dipesh KC

Posted 2010-10-26T21:12:00.193

Reputation: 125

1

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

  1. Navigate to chrome://net-internals/#dns and click "Clear Host Cache"
  2. 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.

David Allen

Posted 2010-10-26T21:12:00.193

Reputation: 111