Skip to content

How to Block Websites on Your Windows PC

“How to Block Websites” is one of the most searched keywords in the Google search. Many people would like to block some websites on their PC which might harm their PC or to restrict kids from browsing malicious content. Although, most DNS service providers block the phishing and malicious sites, there are still some websites which are tagged on the base of age group and interests. For suppose, we don’t want our kids to start indulging in social networking sites at a tender age.

You could block the websites at router level so that no one in the network can access the blocked websites but that would not be feasible in all cases. If you want to block websites on a single PC connected by any network, then you can’t just block websites at router end. In that case, you need to block sites at the PC end where the websites would be blacklisted on any network. Well, it’s not as complicated as it sounds and on the other hand, it’s quite simple.

All you need to do is to know the Windows environment and modify some system files with administrative privileges. In this tutorial, we will block the websites by blacklisting them in the hosts file of your Windows PC. A hosts file is the local system file which is used to map hostnames to IP addresses. So, if an entry is found in the local hosts file, your browser won’t contact the DNS servers to resolve the address. So, let’s see how to edit the hosts file to block websites on your Windows PC.

How to Block Websites on Your Windows PC

  1. Launch any text editing software on your PC in administrator mode. I prefer the Notepad++, but you can also use the Windows notepad software. To do this, search for the software in the Start menu and right-click on it. Now select “Run as administrator” and click Ok when prompted.
  2. In the notepad software, click on File » Open and navigate to the below path on your PC.
  3. Now select the hosts file and open it in the notepad editor.
  4. In the hosts file, add the below line at the end to block any specified website. For instance, let’s block on your PC.

    Replace “” with any website name you want. The is a non-routable address which means it blocks the websites associated with it. You can also use “” and it will redirect the website to your local host.

  5. Save the hosts file (Press Ctrl+S keys to save) and exit.

If you ever wish to unblock the website, all you need to do is to remove that line from the hosts file again. So, isn’t it easy to block a website on your Windows machine with nothing more than a notepad editor.

Let us know if you found this tutorial useful and also share it with your peers.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.