Block Websites In Windows 7 By Editing Hosts File

Let’s talk something geeky today. Do you know how to block websites? Hmm, I am not talking about any particular browser or about any specific addon. Can you edit hosts file to block websites in Windows 7? Yea, this is what we will discuss today. Although there are several ways by which you can block websites but I guess if you know this method of editing hosts file on your system then you won’t require any other method ever.

Hosts files are actually system files which without any DNS resolution maps hostnames and IP addresses. So if you want to completely block any particular website then you have to perform some steps. Lets see what are you supposed to do.

Steps To Block Websites In Windows 7

  • Locate Hosts file at

C: > WINDOWS > system32 > drivers > etc

  • Open the hosts file with the help of notepad. In this case we are using Notepad ++.

Quick Tip: Make sure you do this with administrator rights. If you don’t have administrator rights then first right click on notepad and Run it as administrator

  • Now add a line at the end of this file

  • If your hosts file already has “    localhost” then add the sitename after this. E.g. localhost

  • Once you are done save the file and now try to access the site which you just blocked with any of your browsers. You will get “server not found” as the error message.

We tested it for on 3 browsers – Chrome, Firefox and Safari. Here are the images from these 3 browsers after editing hosts file.




This is how you can block websites in Windows 7 by editing hosts file. The blocked site will remain blocked in every browser. There are other methods too as we told you earlier. Some people use the parental control feature of Windows. There are certain software which comes for parental control but we found this one as best method. Try it out and if you have any other method then do share with us. :)

About the author

Rockin Satyesh is founder and editor-in-chief of iTechMag. He prides himself in testing web & mobile apps. Satyesh is into web research and strategy development from past 5 years. He can be found on Facebook, Google and microblogs on Twitter as @rockinfuture


how to block a website in windows 7 host file,how to block websites in windows 7,how to block youtube in windows 7,block websites host file windows 7,how to block website in windows 7 host file,how to block youtube on windows 7,how to block websites in windows 7 hosts file,how to block a website on safari on windows 7,block websites hosts file windows 7,block websites windows 7,

{ 8 comments… read them below or add one }

Leave a Comment

Previous post:

Next post: