How To Block Websites on Windows 10/11 with Host File

The world of internet is a pool of numerous websites which has turned everything digital. But not all those website might be appropriate for everyone.Suppose that you want to stop your friends or children from opening a particular website on your computer. Just telling them to stop opening them wouldn’t be a great solution. If you feel that you need to block certain sites manually be changing certain settings on your system, here you go. This article is going to navigate you perfectly through the steps you need to follow in order to accomplish it.

But before we proceed, let me introduce you to a new term Windows Host File. The hostnames connected to a network needs to be mapped to their corresponding IP addresses. This is done so to uniquely identify a particular system in a pool of systems connected to the Internet. This Windows Host file is responsible for providing this mapping function. Slight modifications made to this file can help you block the particular website. Well, now let us start discussing the process.

Also read:


Step 1 – Open your file explorer and copy and paste the given path below to address bar and go to etc folder.



Hosts Folder System 32 Windows 10


Step 2 – 

Now, Right click and copy the hosts file and paste it somewhere else on your computer. Lets copy and paste it on desktop.

Copy Hosts File Windows 10


Step 3 – Go to desktop where you have pasted the file and right click and click on open with.

Hosts File Open With Windows 10


Step 4 – Now, choose notepad as the option to open the file with notepad.

Open With Notepad

Step 5 – Once the file opens up, just scroll down and copy and paste these two lines at the bottom. Just make sure to change the websitename with the name of the file which you want to block.

For example if you want to block facebook, just put the code as shown below.



Now, save the changes to the file.

After that, copy and paste this newly created file back again in the etc folder. The original file will get replaced.






How to redirect Blocked website to another website

Now suppose that you need to make any other website open up when your friends secretly try to open up the site you had opposed. Lets see how it can be done.

  • Open up the command prompt and type ping The sitename is the name of the site to which you want the website to be redirected on. Say for example you need to redirect to, you can type ping This will give you the IP address of the site.

cmd command


As shown above,I have obtained the address for

  • Now, as described above, instead of adding to the bottom of notepad, you can add


IPaddress is the address you have currently received from command prompt and website name is the name of the site you want to redirect to another site.

redirecting site


In my case, I am redirecting the site to the Google’s site which has the IP address From now on the Google’s site opens up when you search for

1 thought on “How To Block Websites on Windows 10/11 with Host File”

Comments are closed.