How to Block Websites Using Notepad

Techwalla may earn compensation through affiliate links in this story.
Image Credit: Jupiterimages/Pixland/Getty Images

If you want to block specific websites from your computer, you can do so by modifying the Hosts file on the computer with a text editor, such as Notepad. The Hosts file is the file on the computer that tells it what websites to map to what IP addresses. By placing a certain line of code in this file, you can block any website you want, and your computer will not be able to get to it.


Step 1

Open Notepad on your computer by clicking "Start," "All Programs," "Accessories" and then "Notepad." If you are running Vista/7, you will need to right-click the program name and select "Run as Administrator."

Step 2

Click "File," "Open" and then browse to the following file: "C:\windows\system32\drivers\etc\hosts." The Hosts file has no file extension. Click the "Open" button.

Step 3

Put two new lines into the Hosts file for each website that you wish to block. The two lines are "\" and "," where "" is the example website you wish to block.

Step 4

Save the file and exit Notepad. The website is now blocked.