In this article we are explaining how to block any website in Windows 8. There may be times when it is necessary to block a website for privacy, due to any website content or simply to avoid websites which use a large amount of bandwidth. In previous version of windows when you want to block a website then we can simply modify the HOSTS file. But in Windows 8 you can't modify the HOSTS file directly. Windows 8 takes a new approach to the host file by default. Its won't allow us to block a website by modifying the HOSTS file.
In Windows 8 one of many changes Microsoft has provided is a native anti-virus program called Windows Defender. One of the things this security program does is protect the HOSTS file from modification. For most users this protection by Windows Defender is a good thing; it prevents malware from hijacking your HOSTS file without your knowledge. For users that want to modify the HOSTS file, however, this is a roadblock in blocking websites with the HOSTS file. If you want to modify the host file to block a website you first have to exclude the HOSTS file from Windows Defender security.
If you are using Windows 7, Vista or XP then you do not need to exclude the HOSTS file from Windows Defender. You can directly modify the HOSTS file using Notepad. Notepad must be run as Administrator.
How to block website in Windows 8
Go to the search box and enter "Windows Defender" and click on the application that appears.
Windows Defender will be opened. In Windows Defender go to the "Settings" tab.
In the Settings tab click on "Excluded files and Locations".
In this step click on "Browse" and navigate to "C:\Windows\System32\Drivers\etc\HOSTS". Select "HOSTS" and click on "OK".
Now click on "Add" and then click on "Save changes". It may may ask for confirmation; then click on "YES".
In this step exit from Windows Defender. Now go to the search box and enter "Notepad" and right-click on the Notepad icon and select "Run as Administrator".
In Notepad go to the file tab and select "Open".
In open windows navigate "C:\Windows\System32\Drivers\etc\HOSTS". Click on HOSTS and click on "Open". In file type "All Files" must be selected.
The HOSTS file will be opened in Notepad. Go to the "127.0.0.1 localhost" line at the end of the HOSTS file.
In this step add a line for each website you want to block. Type the number 127.0.0.1, followed by a space or tab, and then type the name of a website, as in the following example. Finally "Save" to the HOSTS file and exit from it.
After saving the HOSTS file, restart your computer and try to open the website. You will be blocked from it.