“How to Block Websites” is one of the most searched keywords in the Google search. Many people would like to block some websites on their PC which might harm their PC or restrict kids from browsing malicious content. Although most DNS service providers block phishing and malicious sites, there are still some websites that are tagged on the base of age group and interests. For suppose, we don’t want our kids to start indulging in social networking sites at a tender age.
You could block the websites at the router level so that no one in the network can access the blocked websites but that would not be feasible in all cases. If you want to block websites on a single PC connected by any network, then you can’t just block websites at the router end. In that case, you need to block sites at the PC end where the websites would be blacklisted on any network. Well, it’s not as complicated as it sounds and on the other hand, it’s quite simple.
All you need to do is to know the Windows environment and modify some system files with administrative privileges. In this tutorial, we will block the websites by blacklisting them in the hosts file of your Windows PC. A hosts file is the local system file that is used to map hostnames to IP addresses. So, if an entry is found in the local hosts file, your browser won’t contact the DNS servers to resolve the address. So, let’s see how to edit the hosts file to block websites on your Windows PC.
How to Block Websites on Your Windows PC
- Launch any text editing software on your PC in administrator mode. I prefer the Notepad++, but you can also use the Windows Notepad software. To do this, search for the software in the Start menu and right-click on it. Now select “Run as administrator” and click Okwhen prompted.
- In the notepad software, click on File » Open and navigate to the below path on your PC.
C:\Windows\System32\drivers\etc
- Now select the hosts file and open it in the notepad editor.
- In the hosts file, add the below line at the end to block any specified website. For instance, let’s block Facebook.com on your PC.
0.0.0.0 www.facebook.com
Replace “www.facebook.com” with any website name you want. The 0.0.0.0 is a non-routable address which means it blocks the websites associated with it. You can also use “127.0.0.1” and it will redirect the website to your local host.
- Save the hosts file (Press Ctrl+S keys to save) and exit.
If you ever wish to unblock the website, all you need to do is to remove that line from the hosts file again. So, isn’t it easy to block a website on your Windows machine with nothing more than a notepad editor.
Let us know if you found this tutorial useful and also share it with your peers.