In my occupation as a sysadmin, I often find times where I need to "game the system" by editing the host file. Doing so preempts any dns records for a domain name and allows me to make the ip whatever I want for a given hostname. This is extremely useful.

The downside to this is that every time I want to change that same hostname to a different IP, I believe I have to close the browser application before the change will take effect. In situations like chrome where I literally have 50-60 tabs open, this can get rather tedious.

Does anyone know of an alternate way to cause these apps to reload the hosts file?

EDIT -- I am speaking in terms of the Windows family of operating systems, specifically Windows 7 and/or Windows Server 2008R2 .

  • The behaviour is significantly different across operating systems. State your platform(s) in the question; lest you receive helpfully intended but highly misleading answers.
    – JdeBP
    Nov 7 '11 at 15:06
  • a next best thing is to save all the tabs google.co.uk/support/forum/p/Chrome/… By the way, what is the usefulness in what you call gaming the system? what does it involve? (I know what the hosts file does but just curious what you're using it for)
    – barlop
    Nov 7 '11 at 15:15
  • @barlop presumably this is for testing internal servers before updating DNS. In IIS for example you might setup a host header and want to test it before updating DNS Nov 7 '11 at 16:36
  • Chunky is right; sometimes you need to test a new server but don't want to change DNS anywhere where someone else might be affected by it. Nov 7 '11 at 16:54

When using chrome, you can go to

and purge the dns resolver cache. As iglvzx mentioned, you can use extensions in firefox to achieve the same function. Unfortunately, it appears that Internet Explorer has no analogous feature at this time.

  • This works in chrome, except that the URL has been munged (by the stack exchange software?). Visitors from the future - note that you probably need to type that url in to chrome exactly (colon slash slash included) and that there should be no http.
    – Andrew M
    Jan 12 '12 at 11:00
  • Thanks Andrew, I went to fix the URL but the interface wont let it become a hyperlink without the http; I'll talk to the devs about this but in the meantime it's demoted itself to regular text, so I just put it in code tags to make it a bit easier to follow. Jan 12 '12 at 14:24
  • How long would it take Chrome to refresh without doing this? For when instructing people who are not tech savvy enough to follow these instructions.
    – Xonatron
    Nov 13 '12 at 17:19
  • @MatthewDoucette it is my understanding, however unverified, that the dns cache will persist until you fully close Chrome. Nov 13 '12 at 18:41
  • MacOS Sierra, Chrome Version 53.0.2785.116 (64-bit), and I need to open anon tab or relaunch Chrome to refresh /etc/hosts entries :/ Oct 5 '16 at 22:33

Have you tried any of the add-ons available for Firefox? Try searching for hosts or dns.


In Chrome go to chrome://net-internals/#sockets then click "Flush socket pools", from https://www.askmehelpdesk.com/chrome/how-can-set-chrome-use-local-dns-hosts-file-831226.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.