How to Block a Website Using Command Prompt

One way of blocking your computer from accessing a specific website is with the Microsoft Windows Command Prompt utility. This feature comes in handy when you want to make sure your children are not going to their favorite websites when they should be studying.

Businessman pushing virtual search bar
Block a website using the Command Prompt tool.
credit: rvlsoft/iStock/Getty Images

Step

Shut down all applications and programs on your computer.

Step

Press the "Windows-R" keys at the same time.

Step

Type "cmd" in the field and select the "OK" button.

Step

Type "notepad C:/Windows/System32/drivers/etc/hosts" in the command window.

Step

Find the line that contains "127.0.0.1 local host."

Step

Type "127.0.0.1 URL" on the next line, with "URL" being the site you want to block. For example, if you want to block CNN, type "127.0.0.1 cnn.com."

Step

Save the file. Exit all windows.