How to Block ANY Website by Editing The Hosts File

The Windows HOSTS file allows you to block sites easily and free. The HOSTS file is a plain text file that you can edit with administrator privileges. This post will walk you through the necessary steps to block multiple or an specific website by adding an entry to the hosts file.

Click on Start and type Notepad, from the results right-click Notepad and Select Run as Administrator.

block-any-website-by-editing-the-hosts-file-5

While Notepad is open, click on File -> Open.

block-any-website-by-editing-the-hosts-file-3

Navigate to C:\Windows\System32\drivers\etc. You will get a blank screen, on the bottom right corner of the screen change it from Text Documents (*.txt) to All Files using the drop down menu. Now, double click to open the hosts file.

block-any-website-by-editing-the-hosts-file-15

To block a website just add the following line on the bottom of the hosts file:

127.0.0.1              www.exampledomain.com

So, if you want to block facebook.com, just add the following line:

127.0.0.1              www.facebook.com

block-any-website-by-editing-the-hosts-file-1

This line will redirect the website facebook.com to the IP address 127.0.0.1 , which is just the loopback address on our local system. If you don’t have a local website setup on your computer, you’ll just get an error page in your web browser.

block-any-website-by-editing-the-hosts-file

If you want to block more websites just add the 127 IP address immediately underneath with the full URL to the right just like we did with facebook previously.

block-any-website-by-editing-the-hosts-file-16

To unblock the website just go back and a number sign before the 127 IP address.

block-any-website-by-editing-the-hosts-file-4

This process applies to Windows 10, Windows 7 and 8.1. If you have any question feel free to post it in the comment section bellow.

Video Tutorial:

Miguel

I started this tech blog back in 2011 as a place to write down processes I took to fix my client systems and network. Now I write some tips and tricks to help others with the tech issues that one might encounter.

You may also like...