How to Block Websites Without an External Application

On
A stop sign on a blue wooden panelEvery day millions of internet users supposed to do some meaningful work spend hundreds and thousands of hours wasting their time browsing aimlessly. Most of the time, they're aware of the fact but just couldn't resist it. That's why several specialized application popped up on the internet that enables you to easily block websites. Some of these applications are self-contained software while others are available in the form of browser extensions. But, this guide is not about these applications. If you're looking to block websites without investing in these apps, you can do so at the operating system level on your own. Though it's not very technical, one still needs to be familiar with basic file editing to get things done. I use this technique for the websites I want to block permanently. For example, domains collecting unnecessary telemetry or diagnostic data. The steps mentioned below are more or less the same for all Windows versions differing only in paths to use, if applicable.

A stop sign on a blue wooden panel
In case, you're not comfortable with the steps mentioned below, I'll strongly advise you to opt for an app instead of doing it manually. It's always better to avoid it if you're not sure what you're doing.

Read Also:
5 Simple and Effective Ways to Quickly Disable a Webcam


So, let's get started and see how we can block select websites permanently to increase our productivity. You can of course remove a website from blocking, at a later date, if you want to do so.

Using Microsoft's Built-in Protection

Let's say your kids access a shared computer at your home and you want to block certain websites for their account. You can do so through the Microsoft account used to log in to the PC. Here's how to do it.

Go to Settings → Accounts → Family and other users option.

Add child Microsoft account in Windows 10
Here, click the Add a family member option button. If your kid already has an account, enter the respective email address else click the link to create a new account for your child.

Follow the prompts to complete the account creation process. At the end of the process, you see a newly created child account in the list as shown below.

Manage family settings for Microsoft accounts
Now, it's time to start the website blocking process. To do that, start with clicking the link mentioning family settings as shown above. It'll take you to your account's family settings. If you're already not logged in, complete the log-in process to go to that page.

Content filters option within Microsoft family settings
Now, go to the More options → Content filters option.

Now, here if you'll start filtering websites and searches, by default, they'll be only applicable on the Microsoft Edge browser. If you're using any other web browser like Chrome or Firefox, the settings won't work with them.

Unblock web browsers for content filtering option
So, to make sure the filtering options work on all of your web browsers, go to the Apps and games tab and remove the web browsers you use from the list. Now go back to the Web and search tab.

Website and search filter for family accounts in Microsoft
Here, switch on the filtering option as shown above. Microsoft provides two ways to filter websites. The first one is to block everything and allow only the ones specified by you.

Blocking websites by specifying URLs
And, the second method is to allow everything and only block the ones you want to. My preference is the second approach. But, if you want to be too restrictive, go ahead with the first approach.

You can add as many sites as you want by providing the URL of each one of them. It's a one-time exercise. Once configured, it gives you peace of mind that your kids are not accessing unwanted websites.

Using Hosts File Blocking Mechanism

There's another way to block websites which involves editing a special file found on almost all popular desktop operating systems. One needs to enter the website details in a specific format in this file to block them completely. Here's how to do it on Windows.

Press Windows + S key and type notepad in the search box.

Open notepad application with administrator priviledge
Right-click on the notepad application and select Run as administrator option from the context menu. Press Ctrl + O to open the file opening dialogue box.

Go to C:\Windows\System32\drivers\etc and select the hosts file in that directory.

Select all files option to display all files
If you can't see the hosts file in that directory, select the All Files option to display it for selection as shown above. Now at this point, you have the hosts file opened and ready for editing.

Content of Windows hosts file
If you want to block yahoo.com, all you need to do is to enter the IP address 0.0.0.0 followed by a space and the domain name as shown in the image above.

For each website, you need to do the same on a new line. Save the file and that's it! In the future, if you ever want to access that website again, just remove its entry from the hosts file.

On a Linux system, the method is the same differing only in the file path and the command to edit it. Here's how to do it.

For example, if you want to block yahoo.com on Linux, use the following command.


sudo sh -c 'echo "0.0.0.0 yahoo.com" >> /etc/hosts'

Here the file path is /etc/hosts, and the sudo prefix is necessary to get the admin privilege required to edit that file.

So, whichever method you prefer, feel free to use it to block websites on your Windows or Linux machines. I use a specialized application for the same, but you can use these techniques too.