Block Ads Using Your Host File

Martin Brinkmann
Nov 24, 2005
Updated • Jan 3, 2017

Th following tip has been around for some time now but its possible that some of you have not heard of it yet. I found a site through Digg that has a neat list of 40000 entries that you can partially or fully add to your Windows host list to prevent ads from those 40000 hosts to show up on your system regardless of browser or program you are using.

Most advertisement that you see on the Internet comes in the form of scripts run on websites. These scripts are usually hosted on third party sites and requests need to be made to run them. To block ads with the hosts file, you simply change the target of those domains in Windows so that the requests land nowhere and as a result, no ads can be displayed from the server.

Its an easy trick. I would be cautious nevertheless, a list of 40000 is not easy to maintain and overlook and it could be that hosts are in that list that you want to have displayed. I suggest you take a look and see for yourself, maybe add only some ads to your hostfile from sites that you visit a lot.

They have a nice faq on that site which answers lots of basic questions e.g. uninstallation, download, install etc. Pretty good site.

Though it has been in circulation for a few years, a text file called “Hosts File” lists 6,000 entries that you can add to your Windows host list, preventing ads from the listed hosts from popping up on your operating system.

The only drawback to Hosts File is that it may list hosts that you do want to display. It would take some tedious editing to weed through 6,000 host entries. A true geek with a sharp eye and fast editing skills may have no problem with this and probably enjoy it. There are few people of such a nature, so it is advised that you look through the list and include a certain selection of hosts to your host file.

A small group of security-conscious techies have compiled a list of 6,000 plus banner advertizing companies and providers including high-risk sites that deliver pop-ups, dialers, spyware, adware, malware, scams, cookies and all of those fun things we just don’t want. Whenever a banner ad is requested from a server, this file tells your computer that it is in its black list, reversing the order of execution that would normally occur so that your computer does not contact the server, but requests itself instead. There are no advertisements on your computer so nothing will be displayed.

This will stop cookies, pop-ups and hostile scripts. Connection speed is increased and you don’t have to be annoyed anymore. If you should find that this does not work out, simply delete the Hosts File from the location in which you stored it and reboot. Alternatively, you could selectively edit it.

Hosts File work the following operating systems (and newer versions of said systems):

  • Macintosh OS8/OS9/OSX 10.1/Jaguar
  • Windows 95/98/ME/NT4 SP6/2K SP3/XP (Pro/Home/Media)/2K3.NET/Vista/PocketPC
  • Linux/Mandrake/Debian/BeOs/SuSe/Knoppix/RedHat

The hosts file is provided as a Zip file and you will need to save it to the desktop before extracting the text file so that you can place it in the correct location as detailed in the website FAQ.

Many readers must be wondering about compatibility with Windows 7. Windows 7 ignores its hosts file by default and they supposedly cannot be accessed. If you want to use Hosts File with Windows 7, there is a trick you can use. The Windows 7 hosts file is located in C:\windows\system32\drivers\etc\ or %systemroot%\system32\drivers\etc\ and cannot be edited by normal users. To edit the hosts file, Click Start – search for “Notepad“, right-click and select “Run as Administrator“. This should launch notepad with elevated privileges. Open the host file from the File menu, edit and save. That should do the trick.

Hosts File is a useful text file to add to your computer’s hosts file and enhance security, but be cautious about it. If it causes any problems, delete it from the file location and reboot. Everything will go back to the way it was.

Update: You can download a program like Hostsman that you can use to subscribe to various lists that are maintained by third parties to add entries to your hosts file automatically.


Previous Post: «
Next Post: «


  1. larman said on February 11, 2008 at 6:16 pm

    FYI: sites such as WallStreetJournal, CBS, etc. use some of these ad sites, so pages may not be fully function when visiting legitimate websites.

  2. tom said on July 2, 2006 at 4:30 pm

    I´am not sure if it is such a good idea to add that many entries to the windows host file.

Leave a Reply

Check the box to consent to your data being stored in line with the guidelines set out in our privacy policy

We love comments and welcome thoughtful and civilized discussion. Rudeness and personal attacks will not be tolerated. Please stay on-topic.
Please note that your comment may not appear immediately after you post it.