If you want to block certain websites from opening in your Windows 11 or 10 PC so that no one else who uses the same computer can access to the blocked websites, there are several ways to achieve this.
If you want to block certain websites so that no program, software or user who uses the same computer can access to the blocked websites, this tutorial will show you two ways to achieve this – by using the mappings of IP addresses to host names feature in hosts file, or by using an extension that is capable of blocking websites on your Chrome, Edge or Firefox browser.
Block a Website in Windows 11/10
The hosts file is a operating system file in Windows that handles mapping of IP addresses to host names. If you map a certain host name (website address) to a certain IP address. When this website address is requested by your browser or any other program, it will be resolved to that particular IP address instead of its actual one.
So, to block a website, we only have to map the website to an IP address that is inaccessible by default such as 127.0.0.1. Here’s how to edit the hosts file to block any website you want in Windows 10.
- On Windows 10 search bar, search for “Notepad“. Right-click Notepad and select “Run as administrator“.
- In Notepad, click on File, then Open.
- Navigate to C:\Windows\System32\drivers\etc. At the bottom of the Open window, click on the drop-down to change it from “Text documents” to “All files” so that the hosts file can be visible.
- Select the hosts file and click on “Open“.
- In the hosts file, on a new line, enter 127.0.0.1, followed by a space or TAB, and then enter the website URL that you want to block.
- To block multiple websites, repeat step 5 and make sure only one mapping per line.
- Press CTRL + S to save the hosts file, or by clicking File, then Save.
- That’s it. Websites that were added in the hosts file and mapped to 127.0.01 will no longer be accessible by any program or browser in the PC.
Things you need to know:
The reason you need to run Notepad as administrator first is because you need to obtain the administrator right this way in order to be able to edit the hosts file. If you open hosts file via open with context menu, you can’t run it as admin. There is no option to run it as administrator from the “open with” context menu.
As for the website URL, the hosts file isn’t very clever (cannot use wildcards). So, you have to list every subdomain of the domain you want to block if you want to block all of them. For example, if you enter example.com, it will block example.com and every pages within the domain such as example.com/example, but it won’t block sub.example.com. You need to manually add all subdomains if you wish to also block all subdomains of that particular domain you wish to block.
127.0.01 is usually inaccessible, thus, commonly used in hosts file to map host names so that they will be resolved to 127.0.0.1 upon request. If your router gateway or the local web server that you run is already using 127.0.0.1, you can use an alternative instead such as 0.0.0.0 which should also be inaccessible.
Make sure there is no # at the start of each line as that would mean to commenting out the line and voiding its functionality.
How to Block Websites on Chrome
If you’re using Google Chrome as your default browser in Windows 10, you can block any website by using a popular extension called Blocksite on Chrome.
Go to here to download the BlockSite extension for Google Chrome. If the link doesn’t work, go to Chrome web store > extension, search for “blocksite”, and install it from there.
After installing BlockSite extension, to start using it to block a website, on your Chrome browser, click on the extension icon and then click on BlockSite. Optionally, you can click on Pin next to BlockSite so that it can be pinned to the extension area for quicker access.
Next, click on the setting icon in the BlockSite extension window.
Under “Block Sites”, enter a web address that you wish to block into the text field. You can repeat to add multiple websites to the block list.
Optionally, for quick block, you can visit to the website you want block, then click on BlockSite extension and select “Block this site“.
How to Block Websites on Microsoft Edge in Windows 10
Similar to that of blocking website on Chrome, in Edge, you can use a similar extension called “Block Site”. You can download the extension here. If link doesn’t work, go to Edge add-ons page, search for “block site” and install it from there.
How to Block Websites on Firefox
To block website on Mozilla Firefox, you can use the BlockSite Firefox extension developed by the same developer of BlockSite on Chrome.
You can download the BlockSite extension from here. Alternatively, you can go to Firefox browser add-ons, and manually search for the “blocksite” extension, and install it from there.
As for how to use the BlockSite extension to block a website on Firefox, refer to the same tutorial above under Chrome section.