How to kick`n`shoot Internet advertisement

What`s new?
If You are new here (this page is never seen by You before) then please begin reading from "Introduction" topic.

New: Changed code of subscription (monitoring page changes).
Last updated:


Here is the description of how to remove annoying banners from Internet pages when You explore them from Your machine. This is quick, easy and free. I checked this under Windows 98 SE, Windows XP Professional SP2 and Windows XP Professional SP3, but I think it can work with other OSes (even not of Windows family).

Certainly, I know about such means to remove adv as using Your own proxy-server or even filtering packets in local network. But most of "home proxy" applications cost money, may require additional system resources, may need installation and sophisticated configuration etc. At all, I don`t like such thing cause a program written by somebody else can contain any unwanted code that You even not informed about (because commercial application author keeps source code in a secret).

What to do

Find file named HOSTS.SAM in Windows folder. Copy it into the same folder but under new name: HOSTS (without extension). [On WinXP You do not have HOSTS.SAM file. You can find HOSTS file in system32\drivers\etc subfolder of Windows folder. And do not copy it anywhere. Edit it where it is.] Open this HOSTS file with Notepad (or other text editor). Add there some lines such as:

where instead of and etc enter domain names of sites to be blocked. NOTE: no http:// or other prefix, slashes (/), directory paths or file names are allowed here; ONLY pure domain names! Domain masks (e.g. * are not allowed. Save the file.

Lines shown force system not to find specified addresses in Inet, but redirect them into "nowhere". I am not very familiar with 127.*.*.* address hierarchy (which is so-called "loopback"), but I discovered some important thing. For address WinSock at least tries to connect (and successfully when there`s working server on Your machine). But results always in one: not found. Connection attempt time for is much smaller than for other 127.0.0.*, so I think it even doesn`t try to send request. This is why I called this address "nowhere".

Instead of You can specify other machine IP address (in LAN or in Internet) and then all correspondent requests will be routed there. It can be used even for displaying Your own pictures instead of banners :) (but that`s much-much harder, of course).

You can delete all comments (lines beginning with # sign) if they tire You. Or Your own comments can be added.


# This was here       localhost   # this domain must not be changed
# Shooting banners
# and other banner systems that exist in Inet

Which domains to specify? Banner systems ("banner networks") domains. If You don`t know any of those try to find em. E.g. You can search such domains by inspecting "Temporary Internet Files" folder on Your machine or by viewing HTML source of pages where banners appear.

The example HOSTS file

You can download an archive (ZIP) with MY example HOSTS file or download an archive (ZIP) with example HOSTS file by ZiMMy. When downloaded, unzip it into Windows folder [On WinXP system32\drivers\etc subfolder of Windows folder], learn and do what is described before. Voilá! Enjoy the clean Inet. As always You use it on Your own risk but do You really think me to be self-dishonored by any evil intentions?

The domains in example file are what personally annoy me or ZiMMy:). You have to change them to Your "favorite" domains i.e. those that personally annoy You.


Local HOSTS file usage is an old tradition in DNS, this is why I`m so sure in possible support for it in non-Windows systems. Don`t expect existence of HOSTS.SAM file in such sys`, but will it stop You?

The USER (i.e. SITE VISITOR) pays provider for connection and he(she) selects the content, NOT the webmaster nor the advertiser! And it is of visitor`s wish whether to allow adv banners or cut em out if they`re extremely annoying.

Of course, some free hosting services and popular sites are alive due to adv and it`s important to live in peace with those. But if some banner network distributes ugly content or something more wrong (violence, corrupting, sexual perversions) then You`re in Your right to isolate yourself (and Your children) from the crap. Internet is not to become "web-TV"!

Be aware that not only banners or pictures are cut but OVER specified sites content becomes inaccessible. No any program can connect to em from Your machine. So HOSTS file can help in more practical tasks, e.g. defending against well-known viruses (when the site of vir author is known from publications or other else). And more. But when some program connects using not domain name but a true IP address then HOSTS file, of course, can`t stop it.

Well, this example
# We do not like militarists

cuts off one militaristic server.


hides You from TV trash.

VC++ programmers may some spend after work and make a joke:

# Greetings to Uncle Billy for his
# company`s great products

At all, even this can be typed:

but I believe that only good people are walking here and I don`t await something like this from You :). The personal disagreements may be solved in more civil manner, e.g. or in my COFEFE.

Firefox-ers` happiness

For those who use Firefox or Chrome web browser there is Firefox`s addon named "Adblock Plus". It cuts advertisement banners when other content of these sites remains accessible. This addon does not work with other browsers, so it is less universal (but more clever) than hosts file.

If You want to monitor this page for changes press correspondent button.


The article author Super-M, 2003-2021.
Text may be freely re-published as long as author info is kept unchanged