If you want to block certain websites on all browsers in Windows PC, but you are not sure how to do it. This tutorial is for you, here this tutorial you will learn how to block Access to any unwanted website on windows without any additional Software.

By blocking or restricting access to specific websites, you can set up effective parental controls to prevent children from visiting inappropriate or unwanted sites.

To restrict or block access to certain unwanted websites on your Windows PC, you have to make some entries or additions into the Windows hosts file. We can add these entries to the Windows hosts file in two different ways:

  1. Manually through File Explorer: You can navigate to the following directory:
    C:\Windows\System32\drivers\etc\
    and open the hosts file using a text editor like Notepad (run as administrator) to make the necessary additions.
  1. Using the Command Prompt: You can open Command Prompt with administrative privileges and use commands such as notepad C:\Windows\System32\drivers\etc\hosts to directly edit the file.

Block any Website on Windows Manually through File Explorer

Navigate to C:\Windows\System32\drivers\etc\.

Restrict Access to Certain website on windows

Open any text editor like Notepad (in administrator Administrator Mode). in Windows Search type notepad and press CTRL+SHIFT+ENTER

Open Notepad in Administrator Mode

Open the hosts file in Notepad

Open Windows hosts file

In the opened hosts file, scroll to the bottom and add entries in the following format:
127.0.0.1 [space] website-name.com
Each entry will block that specific website on your Windows PC, so repeat this step for every site you want to restrict. The website-name can be any site you wish to block, such as facebook.com, youtube.com, or any other unwanted website.

Block any website on windows using hosts file

Save the changes and close the hosts file.

Block Specific Websites on Windows Using Command Prompt

Follow these steps to Block Certain Website in Windows PC using Command Prompt.

  1. Open Command Prompt as Administrator by Pressing Win Key + R, run window will open, type cmd into the text box and press CTRL+SHIFT+Enter
Open Command Prompt in administrator mode using Run Command
  1. In Command Prompt, First insert line break , type or past the following command and press enter key

echo. ^ >> %WINDIR%\System32\Drivers\Etc\Hosts

  1. Type/past the following command and press enter key, and replace “websitename.com” with the address of a website that you want to block in your Windows PC.

echo 127.0.0.1 websitename.com>> %WINDIR%\System32\Drivers\Etc\Hosts

suppose we want to block www.bing.com on Windows

Block Websites In Windows using Command Prompt
  1. To check whether Bing.com is blocked or not on your Windows PC, open your browser and visit www.bing.com.
Block Websites on Windows Browsers Using Command Prompt

Here you can see that bing.com is not opening in the browser.

I hope this tutorial has helped you understand how to block access to specific websites in Windows using the Command Prompt and the hosts file. Following these steps will allow you to manage or restrict unwanted sites effectively, whether for parental control, productivity, or security purposes.

If you have any questions, suggestions, or feedback, feel free to reach out to us through the Contact Us page. Your input helps us improve and create more helpful guides for our readers

FAQs – Block Websites on Windows

1. How can I block a website on Windows without using any software?
You can block websites by editing the Windows hosts file. Add entries like 127.0.0.1 website-name.com to redirect those sites to your local machine, effectively blocking them.

2. Can I block websites using Command Prompt?
Yes. Open Command Prompt as Administrator and type notepad C:\Windows\System32\drivers\etc\hosts to edit the hosts file directly. Then, add the websites you want to block.

3. How do I unblock a website later?
To unblock a website, open the hosts file again and remove the line that contains the website’s address, then save the file.

4. Does these methods work on all versions of Windows?
Yes. This method works on Windows 7, 8, 10, and 11, as the hosts file structure and location are the same across all versions of Windows.

Leave a Reply

Your email address will not be published. Required fields are marked *