Speed up your browsing with help from your hosts file

Published 06 Aug 2016 in Macintosh, Privacy, Security, Software by ZigPress

Web pages these days are so full of advertisements, trackers, counters, hidden pixels, it’s a wonder they load at all. And who knows what information you’re revealing about your browsing habits.

Browser plugins like Adblock Plus and Ghostery can filter out a lot of the crud, but because these are scripts run in the browser itself, they can’t always stop the content actually being downloaded – they just hide or disable it once it’s arrived. So your web page will speed up but not by as much as is actually possible.

A better way to stop a lot of this unwanted material before it even reaches your computer is to get your operating system to block it for you.

This is done by editing (or replacing) a specific file on your computer, called “hosts“.

When your computer is asked to find a URL, whether it’s a web page, an image, a counter, or anything else, it first checks its hosts file to see if there is a particular entry telling it where to look, before it then hits the internet in order to find the object.

So it follows that if you don’t want to receive any advertisement images from (say) “adverts-r-us.com”, then if you add an entry to your hosts file saying that adverts-r-us.com is actually on your own computer, not on the web, when you computer loads a web page containing an ad on that domain, it will immediately fail to find the ad, so your browser will receive an error (which you’ll never see) and you won’t receive the ads. And this all happens in milliseconds because your computer isn’t even touching the web. Neat.

Of course, there are thousands if not millions of domains that serve up advertisements, counters, trackers, etc, and it would take a lifetime to find all of them and add them to your hosts file, by which time new ones would have sprung up. You’d never manage to block everything that is slowing down your browsing experience.

Guess what: someone has done it for you. At the someonewhocares.org website, an enterprising guy called Dan Pollock has posted a hosts file containing about 12,000 entries relating to domains that either serve you ads or track you in some way. So if you install it on your computer, your browser will be downloading much less unwanted material. This file is updated regularly, by the way.

Installation on a Mac

  1. Go to http://someonewhocares.org/hosts/ and you’ll see the contents of Dan’s hosts file. Drag your mouse from the first ‘#’ under the page title, right down to the bottom of the page (there will be a lot of scrolling so it will take a minute) and then copy it with CMD-C.
  2. Open your favourite text editor (I like TextWrangler though TextEdit should be fine), start a new document, paste what you just copied into the document, and save it on your desktop as a file called “hosts” (not “hosts.txt” or “hosts.doc”, just “hosts”).
  3. Now you have to put your new hosts file in the right place so your Mac will find it and use it. Open a Finder window and browse to the “etc” folder. It’s in the root folder of your boot drive. You may have to enable showing hidden files in order to see it.
  4. In that folder you’ll see there is already a file called “hosts”. No problem, rename it to “hosts.old”. You Mac will probably ask you for your password before renaming it for you.
  5. Now drag your new hosts file from your desktop into this folder. Again, your Mac will probably insist you enter your password before allowing the move.
  6. As a final step I restarted my Mac, to be sure that it would start using the new hosts file. I’m honestly not sure if you need to do this.
  7. Get ready for faster (and more private) browsing, especially on commercial sites with busy layouts and lots of advertising and trackers.

I’d recommend revisiting Dan’s site every few months and repeating the process, so that you pick up new trackers and domains that have been added.

Installation on Windows or Linux

If you read the hosts file on Dan’s website, you’ll see that in the initial comments block (all the lines starting with ‘#’), he’s given instructions for other platforms including Linux and various versions of Windows.


  1. On 10 Sep 2016 at 18:19, kaushik gandhi said:

    but is it a good idea to tamper the host file cause the ip might change for some website right ?

  2. On 11 Oct 2016 at 09:25, Selenium Training said:

    very useful article thanks for sharing

  3. On 13 Oct 2016 at 09:30, Sravya said:

    WOW!Thanks for sharing your informative and amazing post, I hope everyone will be benefited if they read all of your post.

  4. On 13 Oct 2016 at 12:24, Asesoria Online said:

    Good article thanks for sharing

  5. On 19 Nov 2016 at 22:13, Ali Imran said:


    Have you tried UC Browser? I used it once and it seems to be a little faster than other browsers and it has an inbuilt adblocker.

    And such browsers are eating away the revenue of bloggers.


  6. On 03 Feb 2017 at 12:34, Anoop C said:

    It’s hard to come by well-informed people about this subject, however, you seem like you know what you’re talking about! Thanks

  7. On 18 Mar 2017 at 09:50, gia halliday said:

    Nice! Gonna give this a try now, thanks :)

  8. On 08 Jun 2017 at 19:14, Mukesh said:

    Adblock is good for users but what about the site owners. How would the survive without ads revenue. Now internet speed computers / mobile are fast enough and users should stop using apps and plugins like Adblock.

  9. On 24 Jun 2017 at 11:18, Atanu Das said:

    Nice Post.. Thank you.. You are awesome..

  10. On 21 Sep 2017 at 08:46, image editing said:

    Thank you so much for sharing this amazing post.

  11. On 09 Oct 2017 at 07:22, Learn Digital Marketing said:

    I don’t know how should I give you thanks! I am totally stunned by your article. You saved my time. Thanks a million for sharing this article.

  12. On 11 Nov 2017 at 19:12, Waqas Ahmed said:

    There are various ways to speed up the browsing, like cache saving method by chrome.

  13. On 05 Dec 2017 at 07:48, mona said:

    Thanks for sharing great article

  14. On 18 Dec 2017 at 12:29, Sakshi Tiwari said:

    great post
    loved the writing style

Add a Comment

If you have used this form and would like a copy of the information held about you on this website, or would like the information deleted, please email info@zigpress.com.