Blocking Ads With Your HOSTS File

By Deane Barker on April 4, 2004

Kill Internet Ads with HOSTS and PAC Files: Using publicly available lists of ad servers, you can block ads by redirecting those domain names to an invalid IP via your HOSTS file.

Compiling a list of ad servers for an ad-blocking HOSTS file would take a lot of time, but happily you don’t have to do it. There are numerous ad-blocking HOSTS files available for download on the Internet. Mike Scallas distributes one that is updated each month.

I tried it, and it works…okay. It blocks some ads, though certainly not all. And sites that use IFRAMES to display ads have the ad replaced with 404 text, which is even more annoying.



  1. Sounds like you didn’t install BlackHoleProxy. I talk about how to do away with the error messages in my article.

    The percent of ads blocked depends entirely on the quality of your HOSTS or PAC file. My HOSTS file was adapted from a Kazaa Lite distribution (no longer available) and it works very well. Perhaps the one you’re using needs tweaking.

    I’m currently using the No-Ads PAC file instead of a HOSTS file because I’m running IIS on my computer and the HOSTS file has problems with this (discussed in the article).

  2. Right you are — I didn’t read it closely enough. The PAC file and the blockhole proxy seem to work very well. Ads just disappear. It uses a technology I was unaware existed before now — Proxy Auto Configuration files. Essentially you can have your browser run a JavaScript function for every single URL it attempts to load. The result of the function either (1) let’s it load, or (2) redirects it to a “blackhole” from which nothing returns.

  3. i’m not affiliated with this browser, but it works amazingly and uses the internet explorer engine. try maxthon, the best ad blocking i’ve seen yet, without all the host file and PAC fudges.

Comments are closed. If you have something you really want to say, tweet @gadgetopia.