How to Modify Hosts Files in Windows 10 to Block Websites

Modify Hosts Files in Windows 10 to Block Websites.

As most Windows 10 users don’t confront the need to touch hosts file on their machines, there are many like you who feel the urge for modification in them so that the unwanted sites can be obstructed from being operated on your browser. But prior to delving into the action, we should take a tour of what exactly you will be doing while modifying the hosts file and what will be the consequences of the alterations.

Hosts File in Windows 10 is basically a text file deeply-seated in your system’s Windows folder but you will not be able to perceive .txt extension with the names in it and the route to it is –


The original file is around 824 bytes in size and the function of this file is to map user-friendly host names to their relevant IP addresses so you can surf them on the internet. When you obstruct a web page inside this file, you won’t be able to access it anymore and these sites are those that you don’t desire to visit for your own reasons.

Let’us see how to Modify Hosts Files in Windows 10 to Block Websites or unblock on a machine forasmuch to restrain or liberate them from accessing via any browser.

How to Modify Hosts Files in Windows 10

Before you commence the journey of modifying hosts file, you need to fulfill two requisite things –

  1. Be an administrator to carry out the modifications as only he has the full power to pull through this task.
  2. Provisionally disable all antivirus programs as these can be resistant to the current procedure.

Once you are done with the above two conditions, you are ready to proceed with the steps –

  • Travel to this place C:\Windows\System32\Drivers\etc and perform a right click on the entry that is described as hosts and from the resultant contextual menu, opt for Open with.
hosts file open with
  • Again a separate menu will be apparent with the list of apps that can open the file, opt for Notepad and thereon click Ok.
Notepad from the list of apps
  • The output window will be of a Notepad with some sort of text, and numbers.

Block a website using Hosts File in Windows 10

  • To restrict or prevent a singular (one) site, you need to input its entry into the end of the file.
  • To block, in the observable Notepad, write after the last line.
How to Modify Host Files in Windows 10 to Block Websites
  • Soon after adding the line, strike File and thereon opt for Save to save the alterations.
Save the modified hosts file
  • Open the web browser and put effort to access that website ( and you will witness that it is being obstructed from appearing and thus will not be perceivable.
website is blocked by hosts file

Unlock the website using Hosts File in Windows 10

  • Now, in near future, if a thought triggered your mind to remove the restriction from the site, simply open the hosts file in Notepad and wipe out the entry of the URL and thereupon save the changes.
Unblock website from hosts file
  • Check and take a glimpse of the website.
Website has been unblocked

Note: While experimenting on How to Modify Hosts Files in Windows 10, we have noticed the websites are not being blocked by IP, the local host one and thus gave a trial with and and guess what? It was on strike!! is a default IP address whereas is a normal public IP address.

We have these two IP addresses to block to separate websites, was assigned to obstruct and was used for

Now, we came across another very interesting thing in this procedure is that while trying to use to block the website, the hosts file did not obstruct it but when tried with, the site was blocked instantly and the same is the case with Facebook.

We are concluding this article here with a hope that with the above-furnished information and steps for how to Modify Hosts Files in Windows 10 to Block Websites you will be able to carry out the modification of hosts file successfully. We are always here to help you out, so you can put your thoughts and doubts in the comments form below.

Sharing is caring    Share Whatsapp

Topics:  Windows 10
About A Saujanya
A. Saujanya is a dedicated tech Enthusiast and digs out hidden Windows 11 & 10 tips.