How to block a website using the hosts file
You can use the below tool to create your own hosts file. This is a free, simple, quick way to block unwanted sites on your computer. Just enter the url(eg www.facebook.com) of the websites you want to block into the textbox below(One url per line). You should block both the www and non-www url’s (eg facebook.com and www.facebook.com)
Websites to block:
Enter the url's you want to block here, then press the generate button. (One URL per line)
Common sites to block
Your custom hosts website block file
Download your new hosts file below, or copy and paste from the textbox below.
Ok, I have my hosts file, now what?
You need to overwrite the old hosts file with the one you just downloaded. Because it is a system file you will need administrator privileges to overwrite this file.
I’m using Windows, Where is the hosts file?
The hosts file is located in your windows system directory. The easiest way to access it is as follows:
- Press Windows key
+ R - type in “%systemroot%\system32\drivers\etc” (do not include the quotation marks “”)
- Copy the hosts file you just downloaded in to this folder (replace the old hosts file if prompted)
This method only allows you to block sites that you know about. If you want to protect your computer and family from harmful and other inappropriate content on the Internet you will need a professional software package.
I’m on Mac OS X, where is my hosts file?
- Open finder and go to /Applications/Utilities and open Terminal
- Type “sudo nano /etc/hosts” to open the hosts file (do not include the quotation marks “”)
- Paste the text from the output into the editor and press ctrl + o to save
- Press ctrl + x to exit the text editor
HELP! I need to unblock the websites I blocked
If you want to unblock the websites you blocked above follow these steps to remove the hosts file.
- Press Windows key
+ R - type in “%systemroot%\system32\drivers\etc” (do not include the quotation marks “”)
- Right click on the hosts file and rename it. You should then be able to delete it.

