How To Block a Specific Website From Loading On Your Computer (Windows 7, 8, Vista and XP)


How to block a specific website from loading on your computer?

This is very simple and doesn’t require any additional software. Once blocked, site will remain unavailable in all web browsers, until you unblock it.

Let’s say you need to block a Facebook from showing in your browser. Run the the following procedure…



1  Open My Computer and navigate to C:\Windows\System32\drivers\etc 2. Double-click on the file named “hosts“. Wait for Open with dialog to appear and choose Notepad in the list of programs. If there is no Notepad in the list, click Browse, enter this as a file name (without quotes): “C:\Windows\notepad.exe” and press Open. You should get something like this (version for XP is a little bit different):


Original Hosts File


2  Add these two lines at the end of the file:

If your hosts file originally contains more lines at the end, ignore them and add new lines after the all existing content. It should look like this:


Facebook Blocked
4  Save and close the file.


Now try loading or in your browser.  Whether you try it with Internet Explorer, Google Chrome, Mozilla Firefox or Opera, they will all return error page like there is no Facebook site out there.

You can add as menu sites as you want to your hosts file and they will all be blocked until you remove blockage from hosts file.  

This can be extremely useful not just for blocking specific site from showing in your browser, but for blocking specific programs to communicate with their origin server.


How blocking websites in “hosts” file works?

Technically, this method redirects all calls for specific website to a specific IP address. 

In this case,  instead of, it will redirect you to, which is your local IP address and it will return unexisting page or your local server’s homepage, if you have local server installed. So, instead of, you can enter some other site’s IP address and it will redirect to that website.

There are many tools/pages on the Internet which can tell you what is the IP address of specific website, so you can easily do this redirection trick for any website.


Alternative titles:

How to prevent unwanted websites from opening in your browser?
How to block a specific website in all browsers?
How to disable specific website from loading?
How to block a Facebook?
How to block particular websites from loading?
How to control which website will open?