For some reasons, many people want to block some specific websites from their browsers. There are settings in each browser that can help us to do this. However, there is a best and general way to block these sites that works for all browsers. It is editing the HOSTS file of your Windows.

Block websites

The “hosts” file is located at C:/windows/system32/drivers/etc. You can find it easily by opening Windows Explorer, then follow the path to locate to the ect folder, or you can just type C:/windows/system32/drivers/etc in the address bar, then press Enter.

Windows hosts file

To block a website, open the hosts file in Notepad (I recommend you to use Notepad or Notepad++ to open it). At the end of the file, add the IP number 127.0.0.1 followed by at least one space and the address of the website without “http://” which you need to block. For example, if you want to block Google, add this line at the end of the file : 127.0.0.1 www.google.com. For each website you want to block, you have to add a line to the “hosts” file for it.

Block websites using Windows hosts file

Finally, save the hosts file (you may need administrator permission to do this). That’s all. Now try visiting the site, you will see the result.