How To Block Websites On Your PC Without Using Software [Windows]

HostsFiles05   How To Block Websites On Your PC Without Using Software [Windows]Any website you visit potentially tracks your browsing habits, loads annoying ads, or distributes malicious software. Most of the time, common sense and standard malware protection software, such as antivirus programs or browser addons can help you steer clear of the worst sites. If you would like to add an additional layer of security, however, and block known offenders, you should look into the possibilities the Windows Hosts file has to offer.

In this article I will show you how to block unsafe websites by adding blocking lists to the Windows Hosts file. The Hosts file allows you to re-direct domain names to an IP address of your choice. Subsequently, you can use this knowledge to block any domains, such as those distributing advertisements, banners, cookies, and more.

What Is The Windows Hosts File?

The Windows Hosts file is a plain text file Windows refers to for mapping hostnames to IP addresses. The file is loaded into the cache at startup and every time Windows queries a DNS server, it first checks the Hosts file for redirection information. Simply put, the Hosts file can be used to re-direct a domain name to a different IP address and hence to a completely different website or simply back to the local computer.

Hosts MUO Net   How To Block Websites On Your PC Without Using Software [Windows]

What Are The Benefits Of Blocking Sites Using The Hosts File?

First of all you can block malicious websites using excluding lists that contain known offenders.

Secondly, if those lists contain ad servers or trackers, you will experience faster website loading times, as all ad and tracking related apps are blocked from loading. Moreover, this protects your privacy and enhances security since your browsing habits are shielded from many known trackers.

Finally, you can play a prank on people by re-directing any website you like, for example Bing to Google.

How Can I Edit The Windows Hosts File?

Mark wrote an article explaining how to block websites via the Hosts file, which covers almost everything you need to know: Create your own Internet Filter with the Windows Hosts file.

I will briefly describe how to edit the file in Windows 7.

  • Open Notepad as Administrator. For this go to > Start > All Programs > Accessories, right-click > Notepad and select > Run as administrator. When asked whether you > (…) want to allow the following program to make changes to the computer, select > Yes.
  • From within Notepad go to > File > Open and browse to the Hosts file, which is located under > C:\Windows\System32\drivers\etc. The folder will be empty as it’s only showing *.txt files. In the bottom right of the folder click the drop-down menu and select > All Files.

HostsFiles01   How To Block Websites On Your PC Without Using Software [Windows]

Where Can I Find Blocking Lists?

A great resource for a customized Hosts files to block ads, banners, and other parasites, can be found on WinHelp2002. The Hosts file on offer has been updated regularly, most recently in June 2011. You can download the file in plain text or as a ZIP file. The Zip file contains a batch file (mvps.bat) to automatically rename and replace your current Hosts file. However, you can also manually add the list via copy and paste from the text file to your Hosts file, following the instructions above.

You can also find Hosts files on hpHosts. You can either follow the installation instructions on the website, or manually copy and paste the list from their Hosts text file into your existing Hosts file.

There are other resources that share blocklists. However, you need to make sure you get a list that has the format ‘IP address domain name’ (without quotes), for example ’127.0.0.1 google.com’ (without quotes), which would redirect the domain name google.com to the IP address 127.0.0.1 (localhost). Of course you can manually add the IP address in case you get a list that is lacking it.

What Tools Can I Use to Manage My Hosts Files?

I recommend HostsMan. Apart from providing a simple interface to add entries to your Hosts files, it also allows you to import blocking lists from hpHosts via the > Update Hosts button.

HostsFiles03   How To Block Websites On Your PC Without Using Software [Windows]

You can either merge this data with your current Hosts file or overwrite it. I recommend merging, since this allows you to simply delete the added information later and not lose anything you have in there already.

HostsFiles04   How To Block Websites On Your PC Without Using Software [Windows]

You can also edit the Hosts file using a convenient user interface.

HostsFiles02   How To Block Websites On Your PC Without Using Software [Windows]

Unfortunately, HostsMan does not currently allow you to import your own text files and merge them with your Hosts files. This is something you need to do manually.

If you liked this article, also check out the following posts on MakeUseOf:

Did you know about the Hosts file before and what are you going to use it for now?

Image credits: John David Bigl III

The comments were closed because the article is more than 180 days old.

If you have any questions related to what's mentioned in the article or need help with any computer issue, ask it on MakeUseOf Answers—We and our community will be more than happy to help.

14 Comments -

0 votes

Quickbrownfox

Will HostsMan work with XP SP3?

0 votes

Tina

Yes, HostsMan is compatible with Windows XP SP3.

0 votes

Mulder

Uh…you know, you can also manage the Hosts file on a Mac, and it’s easier.

0 votes

Tina

Thanks for the comment Mulder. Maybe one of our Mac writers can cover this story for the Mac.

0 votes

Jim S.

OpenDNS is another “no software” install and provides a number of tools of control access to sites (not to mention their own blacklisting services).

0 votes

Oaken

+1 for Hosts Man. I have used the portable version with both XP sp3 and Windows 7 sp1 64bit for some time, and it works very well indeed.

0 votes

JoeyDee

+ 100 on the use of MVPS hosts & HostsMan to manage. I also use Peter Lowe’s Adserver’s list :http://pgl.yoyo.org/as/serverlist.php?hostformat=hosts&showintro=1&mimetype=plaintext which can also be managed in HostsMan’s GUI.

I found hpHosts to be too restrictive & appeared to slow my browser. (FF)

@11ec7624427d5608ca82b850e42ceec2:disqus : >>>Uh…you know, you can also manage the Hosts file on a Mac, and it’s easier<<<

Sharing is caring. :)

0 votes

JoeyDee

Forgot to add: I just recently started posting here, just wanted to say thanks to all who contribute, especially @ Tina!

0 votes

JoeyDee

Why did my original post get “held”—”Awaiting moderator approval”…yet this one did not. AAMOF, why do I still need moderator approval after posting about a dozen times previously WITHOUT needing such?

Very BIZZARE behaviour, please advise, TYVM.

0 votes

Tina

 Your previous comments contained links. And since you have not been whitelisted, a moderator needs to approve your comments if they contain links.

0 votes

JoeyDee

Thanks, Tina…that makes sense….HOWEVER, I’m pretty sure I’ve posted links previously without the “delay”…I could be wrong, though.

BIZZARE, indeed.

0 votes

Tina

Thanks for the feedback, JoeyDee and glad to hear you enjoy our articles!

0 votes

grantdb

Great info! I use HostsMan with the MVPS list and it works great.  Regarding the “merging” or “overwrite” option, it is suggested to use the overwrite because as the lists are updated old listings are deleted.  If you merge when updating you will still have the old outdated listings.  This could potentially lead to problems with a large hosts file and a bunch of outdated entries. You can always revert to the windows default hosts later or use the built-in exclusion list editor for unblocking if you want.

Grant

0 votes

Tina

Excellent advice, Grant.