How to Block a Website in Safari

How to Block a Website in Safari

Understanding how to manage the online content you or your family have access to is an essential skill in today’s digital age. Apple’s Safari web browser does not have built-in functionality to block specific websites. However, Apple’s Screen Time feature provides a way to do this effectively. Screen Time is a feature that Apple introduced with iOS 12, and it’s also available on macOS with the release of macOS Catalina. This tool allows you to set content and privacy restrictions, including the ability to block specific websites.

Before we proceed, it’s essential to understand that the instructions below may slightly differ based on the macOS version you’re using, though the general principle remains the same.

  1. Enabling Screen Time on Mac
    To enable Screen Time on your Mac, follow the steps listed below:

Click the Apple menu located in the top left corner of your screen.


From the dropdown, choose System Preferences.


From System Preferences, select Screen Time.


If Screen Time hasn’t been set up on your Mac before, you’ll be greeted with an introduction screen, summarizing what Screen Time is all about.

Click “Turn On” in the bottom-right corner to activate it.

  1. Setting Up Content and Privacy Restrictions
    Once Screen Time is enabled, you can set up content and privacy restrictions. Here’s how:

Click the “Content & Privacy” tab in the sidebar.


Click the lock icon in the bottom-left corner of the window. You’ll need to enter your administrator password to make changes.


Once unlocked, enable the “Content & Privacy Restrictions” checkbox.

  1. Blocking Websites
    Now we’ll look at how to block websites in Safari using Screen Time’s content restrictions. Follow these steps:

Within the “Content & Privacy” tab, select “Content”.


Click the “Web Content” section.


You should see three options: “Unrestricted Access,” “Limit Adult Websites,” and “Allowed Websites Only”. If you’re only looking to block specific websites, choose “Limit Adult Websites”. This option also gives you the flexibility to customize the list of restricted and allowed websites.


To add a website to the blocklist, click on the “+” button under the “Never Allow” section and enter the URL of the website you wish to block. From this point on, whenever someone tries to access this site on Safari, they’ll be met with a block message. You can add as many websites as you’d like to this list.

  1. Saving Changes and Locking Preferences
    After setting the necessary restrictions:

Make sure to click the lock icon again to prevent further changes without the administrator password.


Close the Screen Time window. Your changes are saved automatically.


Keep in mind that these restrictions only apply to the Safari browser. If you have other browsers installed on your Mac, the blocked sites can still be accessed through them.

  1. Blocking Websites on Other Browsers
    If you want to ensure a website is blocked across all browsers, you can use the Terminal app to modify your hosts file. This method requires more technical expertise and should be approached with caution. Incorrect changes in Terminal can cause significant issues with your Mac.

Here are the steps:

Launch Terminal from Spotlight or your Applications/Utilities folder.


Type sudo nano /etc/hosts and press Return.


Enter your Mac’s administrator password and press Return.


You’ll see a file with some text. Scroll to the bottom using your arrow keys.


At the bottom, type 127.0.0.1 followed by the URL of the site you want to block. For example, to block www.example.com, you’d type 127.0.0.1 www.example.com.


To block more sites, begin a new

line with 127.0.0.1, followed by the URL of the next site you want to block. Ensure each URL is on a separate line.

Here’s an example of what this might look like:


127.0.0.1 www.example1.com


127.0.0.1 www.example2.com


127.0.0.1 www.example3.com


Once you’ve added all the websites you want to block, save your changes and exit:

Press Control+O to write the changes. Press Return to confirm.


Then, press Control+X to close the nano editor.


Back at the Terminal prompt, type sudo dscacheutil -flushcache and press Return. This command clears your DNS cache, enforcing the new changes to take effect.


Your hosts file modifications should now be in effect. Any websites you’ve listed in the file should be inaccessible from any browser on your Mac. If you ever want to unblock a website, you can return to the hosts file and delete the corresponding line.


While Safari may not have a built-in website blocking feature, Apple’s Screen Time and the hosts file method offer a robust alternative. By controlling the content accessible on your Mac, you can create a safer online environment for yourself and your family. Be mindful of potential risks and make sure to take full advantage of the tools at your disposal. The digital world is an expansive landscape filled with both enlightening and harmful content. The ability to filter this content effectively is an empowering step towards safer browsing.