How to Block Websites in Windows


Searching for how to block websites?  Well everyone wants to block unwanted websites to keep there network clean even parents want to block websites to keep their children away from dirty stuffs.

In the previous tutorial, I already covered how to open blocked sites & today I’ll be covering how to block websites on your PC. So to make this task easier I came up with a very simple method that will guide you in blocking websites on your pc. 

How to Block Websites in Windows?

So in this method, we are going to edit the windows hosts file in order to block websites. The hosts file is like a local DNS server in windows operating system. It is used by an operating system to map hostnames to IP addresses. So before st here a step by step guide on how to block websites on your computer.
  • Go to start and search for the notepad.
  • Right-click notepad and click on run as administrator.
  • Now go to file – open, In file name type the file location given below and click open.


  • Now it will open hosts file and it looks something like this :

How to Block Websites Using Hosts file

  • So here’s the tricky part, scroll at the bottom of the hosts file and add followed by the website URL that you want to block.

For Ex – Suppose I want to block so I’ll add the following line :  
Tip – Enter the URL of the website including www otherwise it won’t work.
  • Now similarly on new line, we can again add a website and in this way, we can block n number of websites as shown below.

How to Block Websites Using Hosts file

  • Save your hosts file and now whenever you try to access those sites it will show Webpage not available.

Watch Video Tutorial


How Blocking Websites Works?

First of all let me explain to you what is DNS server. DNS server is used to translates the website domain name into their respective IP address so that means DNS server contains a list of domain names with their IP addresses.
As I have written earlier hosts files act as a local DNS server within windows. So in the above method, we have assigned a NULL Ip address to the website that we want to block. As the Ip address is NULL (Not working) hence we are no longer able to access that website.
Using hosts file we can also redirect one website to another that means we can redirect to We just need to replace with the Ip address of the website that we want to redirect.

Hope you are able to block unwanted websites, If you have any doubts then feel free to ask in comments. 


Please enter your comment!
Please enter your name here