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

127.0.0.1     sitename.com

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

127.0.0.1 localhost sitename.com


  • 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 twitter.com on 3 browsers – Chrome, Firefox and Safari. Here are the images from these 3 browsers after editing hosts file.

Firefox

Safari

Chrome


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

Tags:

how to block a website in windows 7 host file,how to block websites in windows 7,how to block youtube in windows 7,how to block website in windows 7 host file,block websites host file windows 7,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 }

Nik June 15, 2011 at 1:52 am

Thanks, this worked as you said. What is the significane of that particular IP. Is this like a “null” IP, such that when I map the website name to it, it just blocks it?

memo July 11, 2011 at 2:36 am

dude i can’t thank u enough thanks for your help

Tony DeMarco August 17, 2011 at 7:53 am

It didn’t work for my Windows 7 mate. Maybe you have other solution there under your sleeves. :)

chris hurles September 17, 2011 at 3:40 pm

This alone does NOT block connections to IP resolved names, “activate.adobe.com” for eg.
I have been trying to manipulate the “hosts” file for more than a year to no avail, another bad point for Windows 7.

HannahGirl November 16, 2011 at 10:09 am

Hey there, thanks for this info! But sadly, it didn’t work for me either… There is no file at all inside the Etc. folder. Any advice? I’m on Windows 7.

Sourng July 1, 2012 at 3:54 pm

Hi dear,
I try to do the same you are, but still not work as you done.
Do you know why?
please tell me more about that.
Thanks

Rockin July 3, 2012 at 5:40 am

Hi Sourng, the process worked fine for us while rechecking the process. I would recommend if you are not getting result from this tutorial then you can block websites from within browsers. We have written tutorials for that also. Kindly refer and do let us know if you face any other problem. :)

moon November 22, 2012 at 6:30 am

This seems like a temp solution. Any other person can reverse the process just simply opening the same file and delete the relevant lines. Question is how to prevent an unauthorized person from running the notepad as administrator and undo the restrictions.

Leave a Comment

{ 2 trackbacks }

Previous post:

Next post: