Simple Way To Block Websites

To block websites on your home computer without spending lots of money in expensive software, here’s a trick for Windows PC.

Step 1: Click the Start button and select Run. Now type the following text in that Run box:

notepad c:\WINDOWS\system32\drivers\etc\hosts

Step 2: Don’t panic if you see some weired characters when notepad opens up. Simply goto the last line of the file and stat typing the websites that you want to block, each seperated by a line break (ENTER).

windows hosts file block website
Save the file, exit and you’re done. No one will be able to access those sites that you have just blocked using this method. The good thing is you can keep on listing as many offensive sites you want to be blocked.

How to unblock?
If you want to remove the ban later, open the same file as mentioned in Step 1 and delete the above lines.

62 thoughts on “Simple Way To Block Websites

  1. thanks a lot but is there a way to block the entire website including all its subdirectories without showing messages like access denied or enter password to get access. I mean the same way HOSTs file work, unable to connect.


  3. This is so good it works on all my browsers like internet explorer or fire fox and google chrome

    Thanks A lot this was really helpful =D

  4. hey this works great on all browsers
    but don’t forget to add the www. for the websites

    do this so that both formats get blocked i tried this on firefox i dont know about any other browsers but it worked on internet explorer too

    This is a great trick

    Thanks A lot buddy this was really helpful =D

    • hey ive edited the file but without www. and saved it.
      now i cannot access to the same file from c:\WINDOWS\system32\drivers\etc\hosts it is saying access denied.

      plz help me

      • Do this task by administrator login you must be using user login account that the reason this massage is appearing, or your system administrator restricted for access.

  5. Yes, you can block whatever website you want to. Are other websites (listed in hosts) blocked successfully and is it only that can’t be blocked?

  6. I would like to know what do you mean by “websites unblocker”. Do you have an example? A web proxy hosted by someone on the internet or some kind of software?
    If it’s a web proxy, I can see why it’s still accessible and that, I’m afraid, can’t be blocked by using the method mentioned in this article.

    If it’s a software installed locally on a computer, then *maybe*, there’s still a way around it.

  7. hey
    i m using wifi at my home. whenever projects are given from college my friends come over to my place and use the facebook and don’t work

    so, how can i block facebook on my whole wifi network

  8. # Copyright (c) 1993-1999 Microsoft Corp.
    # This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
    # This file contains the mappings of IP addresses to host names. Each
    # entry should be kept on an individual line. The IP address should
    # be placed in the first column followed by the corresponding host name.
    # The IP address and the host name should be separated by at least one
    # space.
    # Additionally, comments (such as these) may be inserted on individual
    # lines or following the machine name denoted by a ‘#’ symbol.
    # For example:
    # # source server
    # # x client host localhost
    i add this line but the facebook still open

  9. than u vcery much
    but i want to block some website on whole my network not only one computer is there any idea to block in my entire network with

  10. One problem… I can’t seem to save the file. I hit save and a sort of error message pops up and says “can not save the file. Make sure the path and file name are correct. Then a window pops up letting me save it as a regular file somewhere on my computer. I did that, and the sites were still working. Any help?

      • this way will only half work since it is only blocking and you can still get to facebook by going to so best solution is to block also

        and to block it from your entire network you have to block it in your router and if you cant figure out how to do it go buy a netgear they make everything clickable

        for problems saveing (vista) run notepad as administrator
        to do this navigate to notepad (start\all programs\accessories\notepad but right click it and run as administrator then navigate to c:\WINDOWS\system32\drivers\etc\ make sure when you get there you change the file types your trying to open from *.txt to all files then edit your hosts file useing the above method and save

        problems saveing (windows 7) in this vershion of windows it is an ownership problem with a quick fix
        download the file and taking ownership is a right clickable option
        again edit useing the above method and save

    • You are not administrator account holder .. thats why that message.
      First run notepad in admin mode and open the file from notepad .. it will work =)

  11. I did as you said but when I try to save it saves in text file. seems like it has protection on the file to modify or change. My os is Win 7. how can I get it saved?

  12. Thanks! Now facebook is blocked from my computer.

    this is what I did localhost www . facebook . com www . friendster . com

  13. Thanks for the great information. When I get home from work I am going to try this on all of our computers. How would I blook facebook from an IPAD?

  14. Please help, i have about 20 computers on my net work, i want to block all unwanted websites i.e facebook, youtube, redtube etc etc, i have linksys router on which i’ve blocked some sites but can’t do them all. I am using RedHat Enterprise Linuc 5 server, don’t have no ISA set up at the moment, what can i do to block all the unwanted websites on my user computers??? one more question is it possible to block 15 computers only on my network not the entire 20 computers? Please HELP….

    • Good point there. I haven’t actually thought about that before.
      Do you know what’s the url of google cache for the website you’re trying to block?
      Let me know and I’ll see if i can spot a pattern.

  15. This is GREAT! I just used it to block Reddit so I’m more productive at home. Thanks for posting this :)

    Have you thought of updating this post to include solutions provided by the comments?

Leave a Reply