Block a website using a Hosts File in Windows

Read Time:1 Minute, 42 Second

There are so many ways on how to block websites from your browsers the trick is simple but powerful. Here’s an easy guide on how to block websites using a host file in your Windows 10.

By default, every version of Windows comes with a special hosts file to resolve DNS records issues. It can be used to define a domain name or an IP address, which will have a priority provided by the DNS server.

The file consists of lines such as an IP address in the text column followed by several hostnames each separated by white space. The tab is often preferred for spaces, and the lines with a hash (#) character are comments because Windows ignores the blank in the host’s file.

The first step is to navigate to the System32 directory of Windows, and the default directory would be like this “C:\Windows\System32\Drivers\etc.”

Create a backup of your host’s file before doing something, or just simply click copy then place it in your backup directory.

In the host’s file directory, click the drop-down menu and select all. Next, right-click the host’s file and open it with Notepad. You will see several entries in the file with the numbers 127.0.0.1, so any website assigned with this IP address will look in the corresponding website and effectively blocked.

To block a specific website you have to do is, type this line below.

Syntax: IP <tab> Website Address
Example: 127.0.0.1 www.facebook.com

So to block a website (or many websites), all you need to do is start a new line at the bottom of the host’s file, and type 127.0.0.1 <tab> www.facebook.com or whatever the name of the site you want to block is.

To test the changes you’ve made, just open the command prompt, and use the ping command to check the results.

ping www.facebook.com

To unblock, just remove the line added in the host’s file.

Happy
Happy
0 %
Sad
Sad
0 %
Excited
Excited
0 %
Sleppy
Sleppy
0 %
Angry
Angry
0 %
Surprise
Surprise
0 %

Leave a Reply

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

Share via
Copy link
Powered by Social Snap