Blocking websites, no matter the reason, is easier than most people think. There are myriad reasons why you may not want certain websites to be accessible from your browser. Maybe you don’t want kids in your house accessing naughty content, or perhaps you want to block those “fake news” sites that are making all the headlines these days.
If you share your Windows 10 PC with your kids, it’s a good idea to block access to certain websites on your PC.
Block Websites Using Your Hosts File
First, navigate to the System32 directory of Windows, which by default should be “C:\Windows\System32\Drivers\etc\.”
Create a backup of your hosts file in case you do something wrong. (I’m sure you won’t!) Simply right-click the hosts file, click “Copy,” then find a place where you want to keep the backup and paste it there.
Back in the “etc” folder right-click the file called “hosts,” click Open With, then select Notepad.
You’ll now see your hosts file splayed out in Notepad format. You should see several entries with the numbers 127.0.0.1. These are loopback protocols which basically translates to “Your Computer.” Any website you assign with this IP address will look for that website on your computer, and fail to do so because that website of course isn’t stored on your computer. This way the website is effectively blocked.
So to block a website (or many websites), all you need to do is start a new line at the bottom of the Notepad document and type 127.0.0.1 www.facebook.com or whatever the name of the site you want to block is.
Open the Notepad program as administrator. To do so, type Notepad in Start/taskbar search field to see Notepad program in search results, right-click on the Notepad entry, and then click Run as administrator.
Click Yes button when you see the User Account Control prompt.
At the Notepad program window, click File menu, click Open, change the file type from Text Documents to All Files (see picture below). Navigate to C:\Windows\System32\drivers\etc (where “C” is the drive letter of your Windows 10 install drive), and select the hosts file.
Click the Open button to open the file with Notepad.
Once the hosts file is opened with Notepad, add the URL of websites that you want to block access to on your PC in the following way:
For each new site you want to block, start a new line and go through the same procedure. When you’re done, just click “File,” then “Save,” and those pesky websites you don’t want in your life will no longer be accessible from any of your browsers. If you decide you miss those sites and want them back, just open the hosts file in Notepad again and delete the specific entries for the sites you want back. (Be careful about what you delete, and whatever you do, DON’T delete the hosts file itself!)