How To Block Any Website Using Notepad

In this post, I am going to talk about how to block any website on your computer without using any software. You can do this with the help of notepad. But if you are too lazy to use notepad, you can just block a website with a mouse click. Interesting right?

But first of all, Why would you want to block a website? There are many reasons why you might need to block a website.

Parental Control – To block adult websites such as porn sites, gambling sites, etc.

You might also want to block social networking sites on a temporary basis, so that you can focus on your work without distraction. Or you can also use this trick as a prank by blocking websites on your friend’s computer.

Method 1) – How to Block a Website Using Hosts File ?

To access the hosts file in Windows you can use the following command in the Run Dialog Box to open notepad and the file.

notepad and fileAs shown in the image above, Type the following command in the Run Dialog Box.

notepad c:windowssystem32driversetchosts

OR just navigate to c:windowssystem32driversetc and open hosts file using Notepad.

After opening the file, Add the following code at the end of the file:

After adding the code, the file will look like this:

after-adding-fb-block-codeSave the file.

And now if you try to access facebook then you wont be able to do so !

When you try to access, An error will occur in the browser saying – “The webpage cannot be found” or something like that.

Method 2) – Blocking Websites Simply by Using Notepad

Open Notepad and copy paste the following code:

@echo off
echo >> C:windowssystem32driversetchosts.txt
echo >> C:windowssystem32driversetchosts.txt

Save the file as BlockWebsites.bat

Now once you open the the batch file, and are blocked. You can modify the batch file according to your needs.

Method 3) – Using a Batch File Created by Amit Agarwal

You can double click on the batch file to block all websites listed in it. And double click again to unblock the websites.

You can download the batch file by Clicking Here.

So that’s all in this post. Thanks for reading. If you have any doubts or questions, you can comment below. I will respond asap !

6 Replies to “How To Block Any Website Using Notepad”

  1. This did not work for me either. I’ve tried several times and it does not help to block a web site.

    1. Are you the admin of your computer? this works when you have the access to write the line in your host file.

Comments are closed.