You can block websites on Windows computer by using the hosts file.
You can use this method to prevent your household or friends from accessing specific websites on your computer.
What is Hosts File?
A hosts file is a plain text file in an operating system which is used to map hostnames to IP addresses. Let me explain how it works in simple English.
For example, you want to launch Facebook.com [hostname]. Usually, the computer checks the hosts file first to find corresponding IP address of the hostname.
If the search is successful, it uses the mapped IP address. If the search is not successful, it finds the IP address of the hostname by sending a query to the DNS.
Here, we are going to map the hostname to your local host IP address to block websites.
Block Websites without Software
- Open the Notepad as Administrator.
- Press Ctrl + O in Notepad. Navigate to the following location.
- Select all files option (see screenshot).
- Open hosts file in Notepad.
- Scroll down to the bottom of the file. To block a website, you need to add the website at the bottom of the hosts file (see screenshot). In this instance, I’m going to block Facebook.
- Save the file. If you’ve got read-only errors while saving your file, then go to properties of the hosts file and uncheck the read-only attribute of the hosts file. Now, you can save the file.
That’s it. The website is blocked successfully. From now on, whenever you try to open the Facebook, it won’t open.
You can use the same procedure to block as many sites as you want.
If you want to unblock the websites, just remove the line which contains the website name you want to unblock.
Alternatively, you can comment it out to unblock a website like this.
I hope the information in this post is useful to you. If you find the information in this post useful, share this post with your friends.