Are you going away from your workstation and intend to block certain websites in your PC for others? It also may be that you are going away from your home for some days and want to stop access of  certain websites which show objectionable stuffs, in your PC for your children. There may also be various reasons that force you to block certain websites in your computer.

Almost all of the internet browsers except Firefox provide a facility to block certain website in their internet options setting. In Firefox, a plug-in called blocksite is required to block websites. In order to block the website, you usually go to internet options of the browsers one by one and you enter the name of websites in the prescribed field.

However there is an alternate and ultimate way which enables you to block websites in your PC very easily. There is no need to go to each browser’s internet options separately. All you need to edit is a text file and enter the URLs of websites you want to block. The websites blocked in this way will not open at all in any browsers installed on your computer.

How to Block Websites in Windows?

  1. Navigate to the folder C:\WINDOWS\system32\drivers\etc and open hosts file in Notepad. Hosts file is a file with name hosts without any extension.
    Hosts File in Windows

    Hosts File in Windows

  2. Go to the end of the file. Click at the end. We want to add something at the end. Press enter to create a new line.
    Adding Websites to be Blocked in Hosts File in Windows

    Adding Websites to be Blocked in Hosts File in Windows

  3. Type 127.0.0.1 and  press space bar once and enter the URL of the website you want to block and save. Repeat this step in order to block more websites. Note that only one URL per line is to be added.
  4. Finally close browser if it is open and restart it again.
  5. If in the future, you decide to unblock a website. Then open the hosts file again and delete the whole line containing the website URL and save.

Note : Adding a domain name will block all the contents from that domain. However, if you want to block only a certain page and not the entire domain then you have to add the URL of the page to be blocked.


Anyone with administrator rights can modify the hosts file and can block/unblock the websites. But anyway, this method provides an extra layer of filtering.