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.
While Notepad is open, click on File -> Open.
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.
To block a website just add the following line on the bottom of the hosts file:
So, if you want to block facebook.com, just add the following line:
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.
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.
To unblock the website just go back and a number sign before the 127 IP address.
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.