Menu Close

Filtering Banner Ads

Written in 1998
Ethernet cables

A year or two ago I got tired of waiting for all those annoying (and often animated) graphics in banner ads to load when I visit various sites, so I started filtering them out using a .hosts file. Several people asked me how to do it, and I soon got tired of sending instructions via email so I wrote this article. Since its original publication, there has been a lot of publicity on the issue, especially with the firestorm of controversy over DoubleClick’s merger with Abacus Direct. The Death of Banner Ads by David Strom outlines some of the arguments against the ads.

This is one of those issues where there are good points on both sides. Advertising revenue does help pay for a lot of the content out there. Unfortunately, the ads get fancier and more distracting and add to your download time for every page. With higher bandwidth connections available to most of us, that isn’t as important now as it was at one time, but it’s still annoying. Also, because of tracking carried out by companies like DoubleClick through the use of banner ads and cookies, there are privacy concerns that are very significant to some people. Also, the graphics and text in some ads are offensive—especially those that come up on and other search engines when you get search results that include any kind of adult content (whether that’s what you were searching for or not).

If you decide you want to do so, there are many options available for filtering out web-based ads. I haven’t used any of them except Norton Internet Security, and it does that along with many other things (they bought the product formerly known as AtGuard).

Using a .hosts file is free and has the advantage of not using up much (if anything) in the way of system resources. The downside is that you have to keep the file updated manually, and some sites are now using JavaScript and other techniques that get around the .hosts file. Also, it doesn’t catch the banner ads at sites like ZDNet and, and some versions of Internet Explorer will refuse to load anything on a page after it finds that it can’t load the banner ad.

If you want to try it anyway, though, here’s how you do it. On a Windows machine, you simply make a plain text file called “hosts” (no file extension) and stick it in your Windows directory. In fact, if you look there now you’ll probably find a file called hosts.sam–—a sample hosts file that shows you how to create a real hosts file.

How does this little text file affect your browsing? The standard IP address for referring to “this machine I’m on right now” (also called the “localhost”) is—any time a TCP application sees that address, it looks on your local machine instead of anywhere else for whatever is supposed to be there. So in the hosts file, all the banner ad servers I know of are listed as being at Instead of going out, finding that server, and downloading the ad, your browser looks on your own machine, doesn’t find the file, and gives you a little broken image icon.

The hosts file wasn’t intended for this kind of use, exactly—it’s normally used to cut down on local DNS traffic. You can stick other domain names and their numeric addresses into the hosts file, if you want to save time in getting to them (skipping the DNS lookup step). For instance, is also—I could stick that into my hosts file if I wanted to do so.

If you want to know more about TCP/IP and IP addresses and DNS and so on, check out TCP/IP Introduction or TCP/IP Overview and History.

I know you can use hosts files on Macs but I’m not going to try to explain it—my Mac knowledge is simply too stale. I found some information that should give you a good start, in any case.

In any case, you can use my old hosts file as a start—just save it as a plain text file and put it in the proper place. It contains all the banner ad servers I had found when I was using it.

Photo by Jordan Harrison on Unsplash