Blocking Spyware Using the HOSTS File

Blocking the unwanted content in your HOSTS file may sound challenging, but the truth is that even an inexperienced user can do it in just a few of seconds.

Locating HOSTS file

First, you have to find the HOSTS file in your system. These are the usual locations:

Windows 95/98/ME = C:\Windows
Windows NT/2K/XP = C:\Windows\System32\Drivers\Etc

“C:” is what usually marks your system drive.
The “System root” might differ accordingly to your operating system. It’s usually “C:\WinNT” or “C:\Windows”.

Once you found your HOSTS file, right-click it, choose “Open with..”, then choose “Notepad” and you’re ready to go.

How does the HOSTS editing work?

The HOSTS file can be used for two main purposes: one is to make websites load faster, as they are cached in your HOSTS file, the other’s for blocking the unwanted online content. Here’s an example of your HOSTS file:

# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
# For example:
# # source server
# # x client host

This means that if you want to make the website easily accessible you have to enter

and if you want to block the website, instead of entering IP adress of the site, you enter the localhost address in the IP field, for example:

Then save the changes and quit.

Remember, the HOSTS file is not an ultimate weapon against spyware and other rogue applications or websites, as the numbers of those are growing so rapidly all the time, but if you update it regularly it might really save you some time and nerve in a long run.