Skip to main content

How to block a website

Whether you’re looking to protect your kids from sketchy websites or protect yourself from distracting sites while working, sometimes we all need to block a website for our best interests. Balancing privacy, freedom, and controls can be tricky to navigate.

While many laptops come with some parental controls already installed, some are more user-friendly than others. We’ll walk you through exactly how to use the settings and how to use host files and routers to do this.

kmiragaya/123RF

Method No. 1: Using parental controls

Both Windows and MacOS have built-in parental controls that you can use, making it easy to block what you don’t want to be accessible on your system. If you find that you want more features, we’ve outlined the best free parental control software.

Parental Controls in Windows 10

Step 1: You must first set up a child account. To do so, go to the Windows 10 settings menu by searching for it or clicking the cog icon in the Start menu.

Step 2: Click Accounts.

Step 3: Click on the Family & Other Users tab and click the Add A Family Member button.

Windows 10 add a child's account settings screenshot
screenshot

Step 4: Click Create One for a Child and follow the on-screen prompts to set up your child’s profile.

Step 5: Go to your Microsoft account page. Under your child’s account, click Overview. Then select the Content Filters tab on the right.

Step 6: Under the Web and Search tab, and within the Filter Settings section, you have a few options when it comes to blocking websites: You can toggle on the Only Use Allowed Websites option, which means your child can only visit websites you’ve listed in the Allowed Sites section. If you choose to leave this option off, however, you can still create lists of allowed and blocked websites. To add websites to a list of allowed content, just navigate to the Allowed Sites section and enter in the websites you want to allow, then click the plus sign icon to add them. You can do the same with blocking websites too: Just navigate to the Blocked Sites section and enter in the URLs of the sites you want to block and click the plus sign icon.

Microsoft Account Family Settings screenshot
screenshot

Using parental controls in MacOS

Windows isn’t the only operating system that allows you to monitor your child’s activities online. As of MacOS Big Sur, Parental Controls has been replaced by Screen Time. Here, you can do a wide range of things, including setting limits on how long you are allowed to use certain apps or sites, blocking certain websites outright, and viewing analytics on your screen time habits.

To block websites using Screen Time, follow these steps:

Step 1: Open System Preferences and click the button labeled Screen Time.

Image used with permission by copyright holder

Step 2: If you haven’t turned on Screen Time before, you will have to do so now to continue. Next, you will want to select the profile you will want to adjust. All the users on that Mac should show up if you’re the admin, and any user connected to your Family Sharing account should appear here as well. Select which user you want from the drop-down menu in the top left corner.

Image used with permission by copyright holder

Step 3: Click the Content & Privacy button on the bottom left of the menu. Here, you can adjust a number of things, but look for the section labeled Web Content. There are three options here. Unrestricted Access is exactly what it sounds like, so you will want to select Limit Adult Websites. This will automatically filter out the most unseemly websites, but you can add any additional websites by clicking the plus sign that appears.

Image used with permission by copyright holder

Step 4: If you really want to control what the user sees, select the Allowed Websites Only option. That means the user will only be able to use sites you approve of. Click Customize and add all the sites you approve of, and the user will be blocked form anything else.

Method No. 2: Altering hosts files

Block using Windows hosts file

Blocking specific websites in Windows is child’s play — and usually child-proof. It’s completely free, doesn’t require any additional software, and takes a few quick alterations to the Windows hosts file on your computer. The hosts file, a plain text file your operating system 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 great way to restrict users from seeing content you don’t want them to see, regardless of the browser and the time of day.

However, keep in mind that you must have administrator privileges to change the file, and it can be a little technical. You can always undo the change if need be, but the process is a little more hands-on than the Windows and MacOS parental controls.

Step 1: You’ll first need to open Notepad as an administrator. To do so, type Notepad into the desktop search bar and then right-click the app that appears. Then select Run As Administrator and click Yes. Then navigate to the host file by choosing File > Open and locating the file through that window. Navigate through to the Hosts file by going through C: > Windows > System32 > Drivers > Etc.  You may need to select All Files from the drop-down file format menu in that same File Explorer window.

Step 2: Select Hosts.

Step 3: In 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 127.0.0.1 and press the spacebar. Next, type the web address of the website you want to block on the same line. For example, type 127.0.0.1 www.youtube.com to block all traffic from the popular video-sharing site.

Image used with permission by copyright holder

Step 4: Continue to add websites you wish to block in this manner, each beginning with 127.0.0.1. followed by a space and the appropriate website. Make sure only to use www and avoid adding http unless you want to render the entry invalid. Do not alter any other text in the hosts file.

Step 5: Once you’ve added the sites you want to block, click the File option in the upper left corner, choose Save — do not change the name or save location — and ignore any warnings regarding editing the hosts file. Then close Notepad when finished.

Step 6: Open 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 and wait several minutes for the changes to take effect.

Using MacOS hosts file

Blocking websites using MacOS works similarly to blocking them using Windows. The process is free, relatively quick, and requires altering your Mac’s hosts file to redirect a specified domain name. It’s a simple process that will prevent users from seeing content you deem block-worthy across browsers, but one that can be reversed if you want to grant access to the sites in the future.

Step 1: Launch Terminal by accessing the main applications folder, clicking Utilities, and selecting the program from the resulting list. You can also do so by searching for the program in Spotlight.

Image used with permission by copyright holder

Step 2: Now it’s time to make a copy of the hosts file just in case something goes awry. Type sudo /bin/cp /etc/hosts /etc/hosts-original on the Terminal command line to make a backup of the file in question. Hit Enter and type in your administrative password when prompted. It may appear as though the keystrokes aren’t being registered properly — i.e., your cursor won’t move — but rest assured that they are.

Image used with permission by copyright holder

Step 3: Type sudo nano /etc/hosts and hit Enter on the Terminal command line to open up your hosts file in a nano box. Then, enter your administrative password when prompted.

Step 4: Once the hosts file is opened, 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 127.0.0.1 and press the spacebar. Next, type the web address of the website you want to block on the same line. For example, type 127.0.0.1 www.youtube.com to block all traffic from the popular video-sharing site.

Image used with permission by copyright holder

Step 5: Continue to add websites you wish to block in this manner, each beginning with 127.0.0.1. followed by a space and the appropriate website. Ensure that you 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.

Step 6: When finished, hold down the Control key and press O to save the changes. Then hold down the Control key and press X to exit the hosts file.

Step 7: Next, type sudo dscacheutil -flushcache and press Enter again to flush your existing cache and put the changes into effect. Alternatively, you can restart your computer.

Once you’re back up and running, open 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.

Method No. 3: Using your router settings

Blocking all users, at all times, on all browsers can take some time using the above methods. Fortunately, your router doesn’t require any external software and is another fantastic tool that will grant you network-wide control over the blocking process. Although we cannot guarantee your router can block specified websites, most routers are equipped with some parental controls for restricting website access completely, during certain days of the week, or even during defined hours.

Step 1: Open the web interface on your router. As a general rule, you can gain access to your router if you input 192.168.1.1 in your browser’s address bar. Next, you’ll need to enter a username and a password, but the defaults can vary based on the router.

If you’re not sure how to access your router, check the label on the device itself for the username and password. You can also check the instruction manual for that information, along with the default IP address. If the information is unavailable, try looking up the router’s defaults at routerpasswords.com or cirt.net.

Step 2: Find your router’s security window that has options for blocking content. You’ll have to do some snooping around to figure out the appropriate settings, but many manufacturers label security menu items as Access Restrictions or Content Filtering.

Step 3: After you find the right window, you’ll be able to type in or copy and paste all of the website addresses you want to block. You might be presented with extra options to restrict the website further through other means. Make sure to click save and apply before closing out the tab.

Blocking a website isn’t difficult, whether you’re trying to prohibit inappropriate content or just trying to keep yourself focused on the task at hand. You can unite a triad of your router, host file alterations, and parental controls to effectively block hazardous websites or inappropriate content.

Editors' Recommendations

Jon Martindale
Jon Martindale is the Evergreen Coordinator for Computing, overseeing a team of writers addressing all the latest how to…
GPT-4: how to use the AI chatbot that puts ChatGPT to shame
A laptop opened to the ChatGPT website.

People were in awe when ChatGPT came out, impressed by its natural language abilities as an AI chatbot. But when the highly anticipated GPT-4 large language model came out, it blew the lid off what we thought was possible with AI, with some calling it the early glimpses of AGI (artificial general intelligence).

The creator of the model, OpenAI, calls it the company's "most advanced system, producing safer and more useful responses." Here's everything you need to know about it, including how to use it and what it can do.
What is GPT-4?
GPT-4 is a new language model created by OpenAI that can generate text that is similar to human speech. It advances the technology used by ChatGPT, which is currently based on GPT-3.5. GPT is the acronym for Generative Pre-trained Transformer, a deep learning technology that uses artificial neural networks to write like a human.

Read more
The best curved monitors for 2023
A person using the Samsung CF791 monitor.

If you’ve never used a curved monitor before, you might not understand the hype. Much like a curved flatscreen, a curved monitor is a popular choice for gamers or anyone who enjoys watching videos on their computer. The unique design can step up your gameplay or make your favorite movie feel that much more immersive.

With so many different brands on the market and a variety of features, pricing, and specs to compare, choosing the right curved monitor might be overwhelming. Fortunately, you don’t need to wade through all the information -- we’ve already reviewed these top picks for you.

Read more
The best Ryzen CPU: Which Ryzen processor should you buy?
AMD Ryzen 7 7800X3D held between fingertips.

The best CPUs made by AMD represent excellent value for their money, offering high core counts and blistering clock speeds at reasonable prices. The most recent Ryzen 7000 range includes processors that can go toe to toe with the best from rival Intel. The question is: Which Ryzen CPU should you pick up?

The Ryzen family is broken down into four distinct branches, targeting the entry-level, mainstream, performance, and high-end enthusiast sectors of the market — otherwise known as Ryzen 3, Ryzen 5, Ryzen 7, and Ryzen 9. They're all great chips in their own ways, but some certainly offer more value than others, and for many, the most powerful chips will be complete overkill. Then, there are also the top CPUs for gaming that belong to AMD's 3D V-Cache lineup.

Read more