How To Block Websites Like Facebook and Twitter on Your Computer

If you are system administrator at a school, college or office, then you must be looking for a good way to block useless websites like orkut, myspace, facebook, twitter etc. from the computers. Or if you are a parent, then you may want to block certain websites from your computer so that you children don’t open them by mistake.

The best solution would be to use some commercial software to block these websites. Another way would be to configure a proxy filter at the network gateway. Both these solutions are the good ways to block websites. But if you are looking for a cheap solution (read Free) which involves little or no technical expertise, then you can use HOSTS file to block websites.

How To Use Hosts File To Block Websites?

1. Open hosts file in a text editor.

The location of hosts file depend upon your operating system,

  • For Windows NT/2000/XP/2003/Vista/7, it is %SystemRoot%\system32\drivers\etc\
  • For Windows 95/98/Me, it is %WinDir%\
  • For all flavours of Linux and unix, it is located at /etc/hosts
  • For Mac OS 9 and earlier, go to System Folder->Preferences
  • For Mac OS X, it is located at /private/etc/hosts

If you are on windows vista or windows xp, go to click on start->run type, notepad %SystemRoot%\system32\drivers\etc\hosts, and press enter.

how to block websites without any software

For other operating systems, simply open the hosts file in any text editor.

2. When the hosts file is open, just look for the line,

127.0.0.1 localhost

Now under this line, add the names of website that you ant to block, in the following format,

127.0.0.1 websiteToBlock

For instance, if you wish to block twitter from your computer, then the following files must be added to the hosts file,

127.0.0.1 www.twitter.com
127.0.0.1 twitter.com

blocking websites without any software1

After adding all the websites that you want to block, save the file. Now try to open the blocked websites in your browser. Yes, it works :)

To unblock the websites again, simply remove those lines from hosts file.

Following is the video demonstration of blocking websites with the help of hosts file -

Comments

  1. Rohini

    wow does work thanks a lot!!!

  2. Deepak

    wow it is working and would be a good trick for me

  3. shadowking

    For Vista/Win7:

    Start – run – cmd – (right click ‘run as administrator’)

    In the command prompt type:

    notepad %SystemRoot%\system32\drivers\etc\hosts

  4. Mayur Somani

    @shadowking

    Thanks for the updates on Windows 7.

  5. Lon LONNN

    I dont know what to do i got windows 7 i want to block facebook

  6. Lon LONNN

    Can somebody please help me how to block facebook?

  7. Lon LONNN

    never mind i got it. WOW it works! YESSSS!

  8. Lesley

    Hiya i have tried this, but it just says access to C:\windows\system32\drivers\etc\hosts was denied. HELP!!!

  9. Mayur Somani

    @Lesley

    See this tutorial, http://www.hacktrix.com/how-to-edit-hosts-file-in-windows-vista

  10. Genesis

    thankz it’s work..

  11. shaahid

    thanks bro

  12. Vanita

    Thank you so much sir….horray…..Love it. Now, my part time hire cannot
    have fun time when I am not here

  13. amir

    GREAT IT WORKSSSSSS…… :))))

    I have this problem in my office and using Clear OS (firewall). Still failed to block even though suggested me to change setting in Local DNS server…

    but when i do this the whole user in the network was block. But with this command,limited users does not have the privliges to change the command lines.

    Well done…now i can relax as the band with is no longer clogged up.

  14. abdul

    plz help me …
    the file host is not getting saved on its original location ,it asks to have permission from administrator..and saves on other location

  15. Mayur Somani

    @abdul

    Check this tutorial http://www.hacktrix.com/how-to-edit-hosts-file-in-windows-vista

  16. tony77

    in my windows 7 says i dont have permision to save in this location. help

  17. Mayur Somani

    @tony77

    Please check this tutorial, http://www.hacktrix.com/how-to-edit-hosts-file-in-windows-vista

  18. sk

    wah………… thanx a lot

  19. nee

    a lot of thanx!
    it’s really works , it is great!

  20. Sharad yadav

    It is very easy to block unwanted sites

Leave a Comment