How to block website on Windows 8 by editing host file

By | July 11, 2014

Using the Windows Hosts file is the easy and quickest way to block the websites on your PC. In Windows previous versions blocking the websites using the HOSTS file was as easy as editing the HOSTS file and add the websites which you want to block and however in Windows 8 it is bit different as it takes the new approach to hosts files by default. Windows 8 won’t let you to block the Facebook and other sites by modifying your hosts file but you can by pass this restriction luckily.

If you add any sites to the Windows 8 hosts file, it will automatically remove them and ignore your changes. Microsoft had introduced the native anti-malware security program with Windows 8 known as Windows Defender and it protects the hosts file from modification. Windows Defender has both the advantages and disadvantages as it prevents the malware from hijacking your hosts file and at the same time it is a roadblocking in blocking the websites using Hosts file.

 How to block website on Windows 8 by editing host file

You need to turn off the Windows Defender and thus it allows to edit the hosts file. If you want to disable Windows defender you need to install security programs like Avast, Norton or AVG. If the Windows automatically detects the third-party security solution then Windows Defender gets automatically disabled. Follow the below steps to exclude the Hosts file from Windows Defender protection.


Step 1

  • Search for the Windows Defender using the Windows 8’s built-in search functionality and run the windows defender.
  • After Windows defender has open, then go to the Windows’s defender settings and excluded files and locations.
  • Now in the file locations box type “C://Windows/System32/Drivers/etc/hosts and hit the add button.
  • Now click on the save changes.
  • You are done and close the Windows Defender.

Step 2

Once after disabling the Windows Defender protection, editing the hosts file on Windows 8 is same as previous version of Windows.

  • Press Win+C and open the Charms menu and click on the search button and type “Notepad” in the search box.
  • Right click on the notepad and option will appear and go to the bottom of the screen and click on Run as administrator.
  • Now click on yes and Notepad will run as administrator.


  • After Notepad is opened go to the File>Open and go to C://Windows/System32/Drivers/etc folder.
  • After going to the folder you should see no files inside the folder and in the bottom in the drop down menu select All files.
  • After selecting all files some files will appear there and select the Hosts file and click open and it will be opened on notepad.
  • Now add what you want to block at the end of the hosts file in the format[Website URL].
  • After adding the sites which you want to block then save that notepad file and close the file once after finishing.
  • Now restart your PC and now all the websites you want to block are blocked successfully. If you want the confirmation you can test it in the browser.

Author: Peter Jacksonn

Peter, the most experienced in The Tech Bulletin team is a professional blogger and interested in reviewing the gadgets, giving solutions for technical queries. He covers the consumer electronics section along with latest apps and games.+Peter