This post will show you how to block websites, without the installation of website blockers or other programs to block websites. Fortunately, all desktop operating systems (Windows, Macintosh OS X, Linux) have a built-in mechanisms that make it very easy to do.
Blocking Websites with the Hosts File
The hosts file contains a shortcut list for assigning name addresses (such as geeklad.com) to number addresses (188.8.131.52). To block websites with using the hosts file, you simply create “invalid shortcuts” for the websites you want to block. The easiest way to do this is to assign the name address for these websites to your computer’s local number address (127.0.0.1).
Host File Location
The location of your hosts file depends on what operating system you’re using. Here’s a quick cheat sheet for Windows, OS X, and Linux:
- Windows: %SystemRoot%\system32\drivers\etc\hosts (typically %SystemRoot% is C:\WINDOWS, but it can be different)
- Mac OS X: /private/etc/hosts
- Linux: /etc/hosts
Editing the Hosts File
You can use any editor to modify the hosts file. In Windows, you can Click Start, Run…, and then type notepad %SystemRoot%\system32\drivers\etc\hosts
To add a website you want to block, just add a new line with 127.0.0.1 followed by the name of the website. For example:
Lists of Websites to Block
Fortunately, there are already numerous existing lists of websites to block. These lists typically consist of websites that are known to be harmful or perform actions such as tracking your browsing activity. Here are a few you may want to check out:
You can download these files and then copy and paste the contents into your hosts file. Another (easier) option is to download and use a host file manager tool called HostsMan. HostsMan provides an easy mechanism for importing website blocker host lists into your own hosts file.
How to Block Porn Sites
Another option is to use Proxy Autoconfiguration (PAC) files to block websites. Eric Phelps has put together some very nice tools for using PAC to block porn sites. He even has put together a VB script to install and configure his porn site blocking method. It will only work on Windows.
This method for blocking porn sites, essentially creates a local proxy that prevents you from being able to connect to porn sites. The disadvantage of using this method is that the browser must be configured to use the local proxy. It is easy to bypass by disabling the proxy option in the browser.
How to Block Websites with DNS Services
OpenDNS is a DNS service you can use to block websites. It is yet another method you can use as a website blocker, without having to install additional software on your computers. It works very much like the hosts file method, by resolving the addresses of undesirable sites to an invalid location. You can sign up for their basic service for free.
Use Privoxy to Block Websites
Privoxy is a superb and free and open source program you can use to block websites. It is already pre-configured to block advertisements and malicious sites. You just need to download it, install it, and configure your web browser to use it.
Once you’ve installed it, you’ll see an icon for it in your system tray. If you right-click on it, you’ll see Privoxy is running.
To take advantage of Privoxy, you’ll need to configure your browser to use it. The exact sequence will vary, depending on what browser you’re using. For most Internet Explorer versions, just go to Tools > Options
Click the Connections tab in the Internet Options dialog and then click the LAN Settings button.
Click the checkbox that says Use a proxy server for your LAN and then click the Advanced button. Finally, in the Proxy Settings window, enter localhost for the HTTP proxy address and 8118 for the port.
I was very pleased to find this site. I wanted to thank you
for this unique read. I definitely savoured all bits and pieces of it including
all the comments and I have added you to my bookmark list to check out new
articles you post.
I read your post.
That was amazing. Your thought processing is wonderful i will keep this guide in mah mind…
I like the post, but perhaps linking to the pages instead of only to the files? Like, winhelp2002.mvps.org/hosts.htm & also this one is pretty neat, too: someonewhocares.org/hosts/
Wow, great information. I was looking for it from last time, and now they have the information they need.
nice information…i loved this post…
Visit Block annoying YouTube Ads!
It’s really great to share.
There are many sites that have bothered me for a long time, it really is a good article for me to be able to block such sites. Thanks for your sharing. It’s really useful to me