Blocking websites on Safari can be essential for maintaining focus, ensuring child safety, or restricting access to certain content. Whether you want to prevent distractions, block malicious websites, or control web activity on a shared computer, macOS provides several methods to achieve this.
Why Block Websites on Safari?
There are several reasons why you might want to block websites on Safari, including:
- Productivity: Prevent access to distracting sites such as social media and entertainment platforms.
- Parental Control: Protect children from accessing inappropriate or harmful content.
- Security: Block potentially dangerous websites that may contain malware or phishing threats.
Methods to Block Websites in Safari
There are multiple ways to block websites on Safari, ranging from built-in macOS parental controls to third-party applications. Below are the most effective methods you can use.

1. Using Screen Time
Screen Time is a built-in feature in macOS that allows users to control and limit access to specific websites.
Steps to Block a Website Using Screen Time:
- Click on the Apple menu and select System Settings.
- Go to Screen Time.
- Select Content & Privacy from the sidebar.
- Click the toggle switch to enable Content & Privacy if it is not already enabled.
- Under the Content Restrictions section, select Web Content.
- Choose Limit Adult Websites or Allowed Websites Only.
- Click the Customize button and add the URL of the website you want to block under the Restricted section.
- Click Done to save your changes.
This method is effective for restricting access to specific URLs without requiring additional software.
2. Editing the Hosts File
Modifying the macOS hosts file can block access to websites system-wide.
Steps to Block Websites Using the Hosts File:
- Open the Terminal application from Applications > Utilities.
- Type the following command and press Enter:
sudo nano /etc/hosts
- Enter your administrator password when prompted.
- Use the arrow keys to move to the last line and add the following entry:
127.0.0.1 example.com
Replace example.com with the website you want to block.
- Repeat this step for every website you wish to block.
- Press Control + X, then Y, and finally Enter to save the changes.
- Flush the DNS cache by running:
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
Once completed, Safari and other browsers will be unable to access the blocked websites.
3. Using Third-Party Blocking Applications
If you need more flexible control, consider third-party software that provides advanced website blocking capabilities.

Recommended Software:
- Cold Turkey: A productivity tool that restricts access to websites and applications.
- Focus: Designed for blocking distractions to enhance work efficiency.
- Freedom: Blocks websites across different devices for optimal productivity.
These applications offer additional control settings and scheduling features that allow temporary or permanent blocking.
How to Remove a Blocked Website
If you ever need to unblock a website, follow these steps:
- Using Screen Time: Navigate to Content & Privacy Restrictions, remove the website from the restricted list, and save changes.
- Using the Hosts File: Open the hosts file in Terminal, delete the blocked entries, save the file, and flush the DNS cache.
- Third-Party Software: Open the blocking application and adjust the website restrictions accordingly.
Final Thoughts
Blocking websites on Safari can be an effective way to improve productivity, maintain security, or enforce parental controls. macOS provides built-in tools like Screen Time, while more advanced users can modify the hosts file for system-wide blocking. Additionally, third-party applications offer comprehensive control options.
By carefully choosing the best method for your needs, you can ensure a safer and more distraction-free browsing experience on Safari.