Do you know that you can completely block certain websites from opening in ANY browser (Firefox, Google Chrome, Internet Explorer, Opera or Safari) present in ANY Windows User Account viz. Administrator, Limited (Standard) and Guest? This can be easily done by editing the Hosts File.

How to block domains and sub-domains?

Suppose you want to block on your computer running Windows 7, so that NO User can access it. Following are the steps to do so:

1. The Hosts File in Windows 7 is located at C:\Windows\System32\drivers\etc\ (Assuming you have installed the OS in C: Drive). Copy this location in your clip board:

windows 7 hosts file location

2. Click on Start Button >> All Programs >> Accessories and look for Notepad.

3. Now Right Click on Notepad and Select Run as Administrator:

notepad run as administrator

4. Click Open (CTRL + O) in Notepad and Paste the Hosts File Address in the File Name field >> Press Enter and Select All Files from the Drop Down Menu >> Now, Click on Open Button:

windows 7 hosts file

The file will get open in Notepad and as shown in the Video above, you are required to enter following line at the bottom of the File:<PRESS TAB KEY><SPACE>

For blocking Multiple Websites, enter as follows:<TAB KEY><SPACE><TAB KEY><SPACE><TAB KEY><SPACE>

If you want to block a sub-domain, then enter as follows:<TAB KEY><SPACE>

5. Click on File Menu and Hit Save to make the changes.

Conclusion: The domain name you just entered after (also know as Loopback IP Address) in Hosts File will NOT open in any Browser, unless you undo the changes.


  • In Windows 7, Notepad running in Administrator Mode can ONLY save the changes you made in Hosts File. You cannot Save the file, if you run the application in normal mode.
  • In Windows Vista and 7, if you get a UAC Prompt then you need to click on Continue button. In case, you get an Error while modifying Hosts File, then check out THIS Article from Microsoft.
  • Since there’s No Administrator Mode in previous versions of Windows viz 98, 2000, ME, NT, Vista and XP, you can edit the Hosts File directly in them using Notepad. The location of hosts file in these also remains same i.e. C:\Windows\System32\drivers\etc\
  • There are many software available on the Internet (like Firewall) which can easily block access to unwanted websites. But, Advanced Users can easily end the Process Tree of these software from Windows Task Manager and other similar task killing programs.
  • Try to allot Limited and Guest Accounts to other users who uses your computer. This will prevent them from editing Hosts File, as it requires Administrator Password in Notepad.
  • Some Security Software like Anti-Virus, Firewall etc. may not allow you to change the content of Hosts File. You are required to temporarily disable their LIVE protection.