13.11.19

Block Access to Websites using HOSTS file !!


A website can be blocked on any Windows computer by editing the hosts file.

Locate the hosts file in Windows Explorer.


  • Windows XP and later versions: C:\WINDOWS\system32\drivers\etc\
  • Windows 2000 & NT: C:\WINNT\system32\drivers\etc\
  • Windows 98 & ME: C:\WINDOWS\


Navigate to the proper directory using Windows Explorer. Double-click the hosts file. Choose Notepad from the list of programs to open the file and edit it in Notepad.


Find the line below:


  • 127.0.0.1 localhost


Right underneath it, add the following lines (replacing badsite.com with the site you want to block):

  • 127.0.0.1 badsite.com
  • 127.0.0.1 www.badsite.com


Click on the File menu and click Save. Close the file. 

The site should be blocked in all web browsers and now instead of trying to access that site, the computer will redirect you to the localhost.