How to Block and Unblock Websites on a Mac

Download Article
Easy ways to block and unblock any website on your Mac
Download Article

Blocking certain websites can keep you productive during the workday or minimize the chance of your child finding adult content. You can create a website "blacklist" for your Mac in several ways. The built-in Parental Control options are the easiest to use, but you can also block websites using the hosts file in Terminal with your administrator account, using third-party web browser extensions or apps, or even on your router. This How.com.vn article teaches you how to block and unblock websites on a Mac.

Things You Should Know

  • macOS has its own built-in website blocker. It can be found in the "Screen Time" settings in "System Settings."
  • You can use third-party apps and web browser extensions to block websites.
  • You can also block websites on the administrative account by modifying the Hosts file in the Terminal.
Method 1
Method 1 of 3:

Enabling Parental Controls

Download Article
  1. How.com.vn English: Step 1 Click the Apple icon icon.
    It's the icon that resembles the Apple logo in the upper-right corner. It's in the menu bar at the top of your screen. This displays a drop-down menu.
  2. How.com.vn English: Step 2 Click System Settings.
    It's in the drop-down menu that appears when you click the Apple icon.
    • If you’re using a pre-Ventura version of macOS, this will be called System Preferences.
    Advertisement
  3. How.com.vn English: Step 3 Click Screen Time.
    It's an icon that resembles an hourglass. In Monterey or later, you’ll find this in the sidebar on the left side of the System Settings/Preferences menu. In earlier macOS versions, you’ll see it in the main System Preferences window.
    • If you are using an older version of macOS (pre-Catalina), click Parental Controls instead. You may need to set up a new account with parental controls.
  4. How.com.vn English: Step 4 Select a family member (if you have Family Sharing active).
    If you are a member of a family-sharing group, you can click the pop-up menu in the sidebar to the left and select the family member you want to restrict from accessing certain websites.
    • If you have an older macOS version, click the lock icon in the lower-left corner and enter your user password. Then click the user you want to restrict.
    • Skip this step if you’re trying to restrict websites on your own account.
  5. How.com.vn English: Step 5 Click Content & Privacy.
    In Ventura, it’s in the main Screen Time window at right. In older versions of macOS (Monterey and earlier), it's at the bottom of the sidebar menu to the left.
  6. How.com.vn English: Step 6 Toggle on Content & Privacy.
    In earlier macOS versions, click Turn On instead. It's in the upper-right corner. This enables Content and Privacy restrictions.
    • If you want to disable all web and content restrictions, click the toggle switch or the Turn Off button to turn content restrictions off.
  7. How.com.vn English: Step 7 Select Content Restrictions.
    In Ventura, it’s the first item in the menu under the Content & Privacy header after you activate the toggle switch. In earlier versions of macOS, click the Content tab at the top of the window.
    • On pre-Catalina versions of macOS, click the Web tab at the top of the Parental Controls menu.
  8. How.com.vn English: Step 8 Select Limit Adult Websites.
    Depending on your version of macOS, you will either find this option in a dropdown menu or in a series of radio buttons next to the Web Content header.
    • Alternatively, you can select Allowed Websites Only. This will block all websites except for the ones you allow.
  9. How.com.vn English: Step 9 Click Customize.
    This option will appear once you’ve selected either Limit Adult Websites or Allowed Websites Only. This allows you to customize what sites you want to allow and restrict.
  10. Step 10 Click + below the "Restricted" box.
    It's the box at the bottom. This is where you can enter specific websites you want to block.
    • Alternatively, if you block all but allowed websites, you can enter the websites you want to allow by clicking the "+" button below the "Allow" box.
  11. How.com.vn English: Step 11 Enter the URL for the website you want to block.
    Enter the web address for the website you want to block next to "URL." Then click Done or OK, depending on your version of macOS.
    • If you want to remove a website from the restricted website, click the website you want to remove and click the "-" button below the box.
  12. How.com.vn English: Step 12 Click Done.
    This saves your list of allowed and restricted websites. Any websites in the "Restricted" list will be blocked.
    • In some versions of macOS, click OK instead.
  13. How.com.vn English: Step 13 Turn off Limit Adult Websites to unblock all websites.
    To remove your restrictions, select Unrestricted Access from the Web Content menu and click Done. You can also:
    • Add specific websites to the Allow box or remove them from the Restricted box to unblock them.
    • Toggle off Content & Privacy in the main Content & Privacy menu of Screen Time to turn off all restrictions.
  14. Advertisement
Method 2
Method 2 of 3:

Using Apps, Extensions, & Router Settings

Download Article
  1. How.com.vn English: Step 1 Install a browser extension.
    Most web browsers have extensions that you can install, which allow you to block specific websites. You can install extensions that block websites on Google Chrome, Safari, and Firefox. Access the store for that web browser and search for site blocker extensions.
    • You can access the Google Chrome store at https://chrome.google.com/webstore/category/extensions. You can access the Firefox extension store by typing "about:addons" in the address bar. You can download extensions for Safari in the App Store.
    • Some extensions you can use to block websites include "BlockSite," "Stay Focused," "Simple Blocker," and more.
    • Be careful of apps with low ratings or too few reviews to judge accurately. Untrustworthy extensions may install malware on your computer.
    • This will only block websites on the browser the extension is installed on.
    • Once the extension is installed, you can go into the settings and add or remove websites from your block list.
  2. How.com.vn English: Step 2 Install content-blocking apps.
    In addition to web browser extensions, you can also download apps that block content on your computer. There are plenty of apps that block websites for both parental control and productivity purposes. These apps include Net Nanny, Freedom, Cold Turkey Blocker, SelfControl, Focus, and more.
    • Some of these apps block websites completely, while others allow you to block certain sites for a specific period of time.
    • You will be able to block and unblock websites from within the app.
  3. How.com.vn English: Step 3 Adjust your router settings.
    Blocking sites on your router will prevent any device using the wireless network from accessing those sites. To access your router, you will need to find your IP address and enter it in your web browser. From there, the procedure will vary depending on what kind of router you have.
    • To find your IP address, go to System Settings (or Preferences)NetworkWi-Fi. In Ventura, click Details… next to your network. You can find the router IP address in the main tab or in the TCP/IP tab.
      • For earlier versions of macOS, click Advanced, then click the TCP/IP tab.
    • Copy the IP address listed after "Router" or "IPv4" and paste it into your browser's address bar. This should take you to your router settings.
    • Enter the username and password to log in to your router. If you have never set these, look up the default password for that router model. (User "admin" and password "password" are common defaults.)
    • Browse the router settings for site-blocking options. Each router brand has a different set of options, but most allow you to block sites in an area labeled "Access," "Content," "Rules," "Blocked Domains," or something similar.
    • Add any websites you want to block. There will most likely be an option to click to add websites. Click this option and then add the website URL you want to block. Remove websites from the list to unblock them.
  4. Advertisement
Method 3
Method 3 of 3:

Blocking Sites with the Hosts File

Download Article
  1. How.com.vn English: Step 1 Open the Terminal application.
    To do so, click the magnifying glass icon in the upper-right corner. Type "Terminal" in the search bar. Then click the Terminal app in the search results.
    • This method does not have a 100% success rate, and is not too difficult to bypass. It's a quick way to block a website on your personal computer for productivity reasons. While not recommended as the only way to block other users' access, you can try it alongside another method for greater effect.
  2. How.com.vn English: Step 2 Back up your hosts file.
    If you make a mistake while editing the hosts file, you could block all access to the internet. Creating a backup copy allows you to return to the original version if this happens. This is as simple as a single command:
    • To back up the host file, type sudo /bin/cp /etc/hosts /etc/hosts-original in the Terminal exactly as it appears. Then press Enter.
  3. How.com.vn English: Step 3 Enter an administrator password.
    The Terminal should prompt you for your password. Type it in and press Enter. You won’t see your cursor moving as you type in the password.
  4. How.com.vn English: Step 4 Open the hosts file.
    To do so, type sudo nano /etc/hosts and press Enter. This command will open your Mac's hosts file in TextEdit.
    • Alternatively, you can edit the hosts file in the main Terminal window using the command sudo nano -e /etc/hosts.
    • Enter your administrator password again if prompted to do so.
  5. How.com.vn English: Step 5 Move your cursor to 127.0.0.1 localhost and press ↵ Enter.
    This line will be close to the bottom of the Host Database text. Use your arrow keys to move your cursor to the end of the line and press enter to create a new line.
    • Don’t edit any other text that comes before this line.
  6. How.com.vn English: Step 6 Type 127.0.0.1 and press Tab ↹.
    On your new line, type out 127.0.0.1. Hit tab to create a space.
  7. How.com.vn English: Step 7 127.0.0.1 www.facebook.com
    Type the URL you would like to block. Do not include "http://." For example, if you want to block access to Facebook, the line should read .
    • Do not copy-paste from another document. This can introduce invisible characters that prevent the text from working.
  8. How.com.vn English: Step 8 Add more URLs you want to block on new lines.
    To do so, press Enter and begin a new line with 127.0.0.1. Press tab and follow it with another URL you want to block. You may block any number of websites, but you must start each new line with "127.0.0.1".
    • In theory, you can include multiple URLs on one line (entering the IP address only once), up to a maximum of 255 characters.[1] However, this may not work on all versions of Mac OS X.[2]
  9. How.com.vn English: Step 9 Close and save the hosts file.
    Close or quit the TextEdit dialog box when you are done, then confirm that you want to save the TextEdit file when prompted. (In some cases, the file may save automatically.)
    • If editing in the main Terminal window, press Control+O to save, then Control+X to close the file.
  10. How.com.vn English: Step 10 Flush your DNS cache.
    This will clear the cache so your browser is sure to check the updated hosts file immediately. The websites you listed should now be blocked on all browsers. The correct command for doing this depends on your version of macOS.
    • If you’re using Ventura or Monterey, type or paste in the command sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder, then press return or enter.
    • For earlier versions of macOS, check out our guide to flushing your cache.
    • You may restart your computer instead to get the same effect. In many cases, the sites will be blocked even without this step.
  11. How.com.vn English: Step 11 Troubleshoot.
    If you can still access one of the websites, your browser may be accessing a different subdomain, accessing the site via IPv6, or bypassing your hosts file for that site. You can solve the first two problems by adding more lines to your hosts file:
    • 127.0.0.1 (URL) without the "www"
    • 127.0.0.1 m.(URL) will usually block the mobile version of the site
    • 127.0.0.1 login.(URL) or apps.(URL) are a couple common variations of home pages. Visit the website and check your address bar for the exact variation.
    • Entering "fe80::1%lo0 (URL)" blocks IPv6 access to the site. Most sites do not automatically connect you via IPv6, but Facebook is a notable exception.
    • If none of these variations work, there is probably no hosts file workaround. Try one of the other block methods on this page.
  12. How.com.vn English: Step 12 Remove the entry to unblock the website.
    Open your hosts file again and delete the entry for the URL you would like to unblock. Save, quit, and flush the cache as described above to push through the change.
    • To undo all changes and restore from your backup, enter sudo nano /etc/hosts-original in Terminal. Press Control+O, delete the "-original" in the name, and confirm the save.
    • You can also add a # before the line containing the website you want to unblock to indicate that the line should not be read. That way, you can always keep the line and delete the # in case you want to easily block it again.
      • For example, you would write #127.0.0.1www.facebook.com to unblock Facebook.
  13. Advertisement

Expert Q&A

Search
Add New Question
  • Question
    How do I block a website on Safari?
    How.com.vn English: Yaffet Meshesha
    Yaffet Meshesha
    Computer Specialist
    Yaffet Meshesha is a Computer Specialist and the Founder of Techy, a full-service computer pickup, repair, and delivery service. With over eight years of experience, Yaffet specializes in computer repairs and technical support. Techy has been featured on TechCrunch and Time.
    How.com.vn English: Yaffet Meshesha
    Computer Specialist
    Expert Answer
    Each browser will have it's own security and privacy settings where you can add sites you want to block or unblock.
  • Question
    How do I use Parental Control without needing access to an Administrator account?
    How.com.vn English: Community Answer
    Community Answer
    This can't be done. An Administrator account is required to change Parental Control settings.
  • Question
    Is there any way to do this without a password?
    How.com.vn English: Community Answer
    Community Answer
    No. An Administrator account is required to change parental control settings.
See more answers
Ask a Question
200 characters left
Include your email address to get a message when this question is answered.
Submit
      Advertisement

      Video

      Tips

      Submit a Tip
      All tip submissions are carefully reviewed before being published
      Thanks for submitting a tip for review!
      Advertisement

      About This Article

      How.com.vn English: Yaffet Meshesha
      Co-authored by:
      Computer Specialist
      This article was co-authored by Yaffet Meshesha and by How.com.vn staff writer, Megaera Lorenz, PhD. Yaffet Meshesha is a Computer Specialist and the Founder of Techy, a full-service computer pickup, repair, and delivery service. With over eight years of experience, Yaffet specializes in computer repairs and technical support. Techy has been featured on TechCrunch and Time. This article has been viewed 1,091,430 times.
      How helpful is this?
      Co-authors: 24
      Updated: September 29, 2023
      Views: 1,091,430
      Categories: Mac
      Article SummaryX

      1.Open System Preferences.
      2.Click the Screen Time icon.
      3. Click Content & Privacy.
      4. Click Turn on in the upper-right corner.
      5. Select Limit adult websites.
      6. Click Customize.
      7. Click + below the "Restricted" box.
      8. Enter the website you want to block and click Ok.
      9. Click Ok.

      Did this summary help you?

      Thanks to all authors for creating a page that has been read 1,091,430 times.

      Reader Success Stories

      • How.com.vn English: Vivian West

        Vivian West

        Dec 30, 2018

        "This was so so helpful! Thank you immensely, How.com.vn, you guys are awesome. "
        Rated this article:
      Share your story

      Is this article up to date?

      ⚠️ Disclaimer:

      Content from Wiki How English language website. Text is available under the Creative Commons Attribution-Share Alike License; additional terms may apply.
      Wiki How does not encourage the violation of any laws, and cannot be responsible for any violations of such laws, should you link to this domain, or use, reproduce, or republish the information contained herein.

      Notices:
      • - A few of these subjects are frequently censored by educational, governmental, corporate, parental and other filtering schemes.
      • - Some articles may contain names, images, artworks or descriptions of events that some cultures restrict access to
      • - Please note: Wiki How does not give you opinion about the law, or advice about medical. If you need specific advice (for example, medical, legal, financial or risk management), please seek a professional who is licensed or knowledgeable in that area.
      • - Readers should not judge the importance of topics based on their coverage on Wiki How, nor think a topic is important just because it is the subject of a Wiki article.

      Advertisement