Home > Computing > Just say no: How to block a website

Just say no: How to block a website

How to block a website

We’ve all been there. You’re sitting at your desk at work, fiddling with some spreadsheets or documents online when you get a sudden urge to take a peek at Facebook. A harmless mistake, sure, but you’re not feeling so productive once an hour rolls by and you’ve gotten absolutely nothing done. And what about those kids of yours? Staying up all night perusing Facebook, YouTube, and god knows what else certainly isn’t conducive to a healthy lifestyle. Fear not, though! There are plenty of ways to block access to certain time-consuming or explicit websites, whether you want to restrict access altogether or only during specified hours of the day.

Here’s our guide to blocking a website using some of the better fool-proof methods. These are tougher to bypass than your standard browser settings, but we’re sure there are ways around them nonetheless.

Pick a blocking method:

Block using Windows hosts file

Blocking specific websites in Windows is child’s play and usually childproof. It’s completely free, doesn’t require any additional software, and just takes a few quick alterations to the Windows hosts file on your computer. The hosts file, a plain text file Windows utilizes for mapping IP addresses and hostnames, can be used to redirect a domain name back to the local computer, essentially blocking the desired website. It’s a simple process and a great way to restrict users from seeing content you don’t want them to see, regardless of what browser they use or the time of day. Keep in mind you must have administrator privileges in order to change the file, and you can always undo the change if need be.

Disclaimer: Altering your computer’s hosts file to block a website can be a little technical. Avoid doing so unless you feel comfortable making the modifications and taking the risk. Proceed with caution.

Number OneEnter “C:\Windows\System32\drivers\etcin the Windows search bar or navigate to the folder by clicking your way through Windows Explorer.

How to block a website: Launch

Number TwoDouble-click hosts and select Notepad when prompted to choose a program to open the file with. Alternatively, you can launch Notepad and navigate to the host file by choosing File > Open, and locating the C:\Windows\System32\drivers\etc folder in your computer’s directory.

How to block a website: Open2

Number ThreeIn Notepad, you will see several lines of text used for mapping purposes. Underneath the last line of text (it should say something regarding a local host), enter “” and press the spacebar. Next, type the specified IP address of the website you wish to block on the same line. For example, type “ www.youtube.com” to block all traffic from the popular video-sharing site.

How to block a website: How3

Number FourContinue to add websites you wish to block in this manner, each beginning with”” followed by a space and the appropriate website. Make sure to only use “www” and avoid adding “http,” unless you want to render the entry invalid, and do not alter any other text in the hosts file.

Number FiveClick the File option in the top-left-hand corner, choose Save – do not change the name or save location – and ignore any warnings regarding editing the hosts file. Close Notepad when finished.

Number SixOpen your favorite browser and test the results! You should automatically get a blank page whenever you attempt to access any of the sites on your blocked list. You may have to restart your browser as well as wait several minutes for the changes to take effect.

Next Page: How to block a website using Mac OS X hosts file

Get our Top Stories delivered to your inbox: