Sometimes, we find ourselves needing to restrict access to specific websites on our PC but are unsure how to do it without using additional software. Fortunately, there is a simple method to block websites directly through your computer's settings. In this article, I'll guide you through an easy process to block any website using just the built-in tools on your PC. Just follow these easy steps:
1. Navigate to the Hosts File Location
First, you need to locate the Hosts file on your computer. This file is responsible for mapping hostnames to IP addresses. Open File Explorer and browse to the following path:
C:\WINDOWS\system32\drivers\etc
2. Find the Hosts File
In the etc folder, you'll find several files. The one we are interested in is named hosts (without any file extension).
3. Open the Hosts File in Notepad
To edit the Hosts file, you need to open it in a text editor like Notepad. Make sure to open Notepad as an administrator. You can do this by typing "Notepad" in the search bar, right-clicking on the Notepad application, and selecting "Run as administrator".
4. Edit the Hosts File to Block Websites
Once the file is open in Notepad, you'll see some lines of text. These lines map IP addresses to hostnames. Under the line that says localhost, add a new line in the following format:
127.0.0.2 example.com
Replace example.com with the actual website you want to block. For example, to block Facebook, you would add:
127.0.0.2 facebook.com
You can add multiple websites by following the same format on new lines.
5. Save the Hosts File
After adding all the websites you want to block, save the hosts file. Go to File > Save or simply press Ctrl + S to save your changes.
6. All Done
Once you’ve saved the changes to the hosts file, the websites you added will be blocked. If you try to visit them in any web browser, you’ll find that they are no longer accessible.
Last updated on November 6, 2024