How to Block Websites in Windows?

Searching for how to block websites? Well everyone wants to block unwanted websites to keep there network clean even parents want to block websites to keep their children away from dirty stuffs.

In the previous article, I have already covered how to open blocked sites, so today we will be covering how to block websites on your computer or laptop. So to make this task easier, I came up with a very simple method that anyone can use to block websites on their computer.

How to Block Websites in Windows?

how-to-block-websites
So in this method, we are going to edit the Windows hosts file in order to block websites. The hosts file is like a local DNS server in the Windows operating system. It is used by an operating system to map hostnames to IP addresses. So if we map the hostname(website URL) to a dummy IP address then the website won’t work on the specific computer.

Here’s a step by step guide on how to block websites on your computer.

  • Go to the Start Menu and search for the Notepad.
  • Right-click on Notepad and click on Run as Administrator.
  • Now go to file ➝ open. In the file name option enter the file location given below and click the open button.

C:\\Windows\System32\drivers\etc\hosts

  • Now it will open hosts file and it looks something like this:

How to Block Websites Using Hosts file

  • So here’s the tricky part, scroll at the bottom of the host’s file, and add 127.0.0.1 followed by the website URL that you want to block.

For Ex – Suppose I want to block geeksgyaan.com so I’ll add the following line:

127.0.0.1            www.geeksgyaan.com

Tip – Enter the URL of the website including www otherwise it won’t work.

  • Now similarly on the new line, we can again add more websites and in this way, we can block ‘n’ number of websites as shown below.

How to Block Websites Using Hosts file

  • Save your hosts file and now whenever you try to access those sites it will show Webpage not available.

Watch Video Tutorial

How Blocking Websites Works?

First of all, let me explain to you what is a DNS server. DNS server is used to translates the website domain name into their respective IP address so that means the DNS server contains a list of domain names with their IP addresses.

As I have written earlier the host’s file act as a local DNS server within Windows. So in the above method, we have assigned a NULL IP address to the website that we want to block. As the IP address is NULL (Not working) hence we are no longer able to access that website.

Using hosts file we can also redirect one website to another which means we can redirect facebook.com to youtube.com. We just need to replace 127.0.0.1 with the IP address of the website that we want to redirect.

LEAVE A REPLY

Please enter your comment!
Please enter your name here