Skip to content
ONLINE 101010 TECH 010101 TIPS
  • Latest
  • News
  • How-To
  • Social
  • Streaming
  • Gaming
  • Reviews
  • Latest
  • News
  • How-To
  • Social
  • Streaming
  • Gaming
  • Reviews
  1. Home/
  2. Social Media/
  3. How to Block YouTube on Your PC or Mac

How to Block YouTube on Your PC or Mac

Sodiq Olanrewaju
October 31, 2022
5 min read
 - preview-media-how-to-block-youtube-windows-mac

YouTube is home to unlimited educational and entertaining content. Still, you might want to block YouTube on your personal or home computer if the website’s becoming too distracting.

Putting YouTube in Restricted Mode blocks adult content and makes the platform safer for your kids or teenage children. You can also block specific channels with inappropriate content. But if you want to block access to the YouTube website on your computer, we’ll show you how it’s done. This tutorial covers steps for Mac and Windows computers.

Block YouTube on Windows PC

You can block websites by modifying the “Hosts file” that Windows uses to configure your computer’s Transmission Control Protocol/Internet Protocol (TCP/IP). TCP/IP describes a set of instructions that dictate how your computer exchanges data over the internet.

Follow the steps below to block YouTube by editing the Windows hosts file in Windows 10 or 11.

  1. Open the Windows File Explorer (Windows key + E), paste C:WindowsSystem32driversetc, and press Enter.
Block YouTube on Windows PC image
  1. Double-click the hosts file.
Block YouTube on Windows PC image 2
  1. Choose Notepad and select OK.
Block YouTube on Windows PC image 3
  1. Scroll to the bottom of the page and press Enter to go to a new line. Type 127.0.0.1, press the Spacebar, type www.youtube.com, and press Enter to move to the following line.
Block YouTube on Windows PC image 4

This command blocks YouTube on all browsers (Safari, Firefox, Microsoft Edge, etc.) except Google Chrome.

  1. Type 127.0.0.1, press the Spacebar, type youtube.com, and press the Spacebar again. This command blocks your PC’s Google Chrome browser from accessing YouTube.
Block YouTube on Windows PC image 5
  1. Press Ctrl + Shift + S, or select File in the top-right corner and select Save as.
Block YouTube on Windows PC image 6
  1. Select All files in the “Save as type” drop-down menu. Afterward, select the hosts file in the destination folder and select Save.
Block YouTube on Windows PC image 7
  1. Select Yes on the pop-up window.
Block YouTube on Windows PC image 8

Close Notepad and try visiting YouTube in your web browser. If you followed these steps correctly, YouTube should display a “Connect to the internet. You’re offline.” error message. If you can still open YouTube, restart your computer and try again.

Block YouTube on Windows PC image 9

Unblock YouTube in Windows

  1. Return to the hosts file destination (Local disk (C:) > Windows > System32 > drivers > etc) and open the hosts file using Notepad.
Block YouTube on Windows PC image 10
  1. Delete the IP address and YouTube website URL(s) in the document’s last line.
Block YouTube on Windows PC image 11
  1. Press Ctrl + S to save the hosts file. Alternatively, select File on the menu bar, and select Save.
Block YouTube on Windows PC image 12

Close the hosts file in Notepad, open any web browser, and check if you can now access YouTube. Restart your computer if your browser doesn’t load YouTube.

How to Block YouTube on Your Mac

In macOS, you can block YouTube in Screen Time or by editing your Mac’s TCP/IP hosts file.

Block YouTube Using Screen Time

Screen Time on Mac computers has content restriction settings for blocking inappropriate web content. Follow the steps below to block access to YouTube on all web browsers installed on your Mac.

  1. Open System Preferences and select Screen Time.
How to Block YouTube on Your Mac image
  1. Select Options in the bottom-left corner and check the Use Screen Time Passcode option.
How to Block YouTube on Your Mac image 2

It’s possible to bypass passcode restrictions from an administrator account. Hence, Apple recommends setting a Screen Time passcode from a standard account.

If you’re using an administrator account, you’ll get a prompt to create a new administrator account on your Mac. Choose Don’t allow this user to administer this computer, create a new user account to be the administrator, and follow the prompt to create a new admin account.

How to Block YouTube on Your Mac image 3

Otherwise, jump to step #3 if setting up Screen Time from a standard account.

  1. Enter a four-digit Screen Time passcode.
How to Block YouTube on Your Mac image 4
  1. Re-enter the four-digit Screen Time passcode to proceed.
How to Block YouTube on Your Mac image 5

The next step is to set up the Screen Time passcode recovery. If you ever forget your Screen Time passcode, you can reset it using your Apple ID.

  1. Enter your Apple ID email and password and select Next.
How to Block YouTube on Your Mac image 6
  1. Select Content & Privacy on the Screen Time settings menu and select Limit Adult Websites.
How to Block YouTube on Your Mac image 7
  1. Enter your Screen Time passcode.
How to Block YouTube on Your Mac image 8
  1. Select Customize.
How to Block YouTube on Your Mac image 9
  1. Select the plus icon (+) in the bottom corner of the block list.
How to Block YouTube on Your Mac image 10
  1. Enter https://youtube.com in the URL dialog box and select OK.
How to Block YouTube on Your Mac image 11
  1. Select OK to save the restriction.
How to Block YouTube on Your Mac image 12

Your web browsers will display a Screen Time pop-up when anyone visits YouTube on your Mac.

How to Block YouTube on Your Mac image 13

To unblock YouTube, select the YouTube URL in the “Restricted” section and the minus (—) icon in the bottom corner. Select OK to save the settings and unblock access to YouTube on all web browsers.

How to Block YouTube on Your Mac image 14

Block YouTube on Mac By Tweaking macOS Hosts File

  1. Go to Finder > Applications > Utilities and double-click Terminal.
How to Block YouTube on Your Mac image 15
  1. Type or paste sudo nano /etc/hosts in the Terminal console and press Return.
How to Block YouTube on Your Mac image 16
  1. Enter your Mac’s password and press Return.
How to Block YouTube on Your Mac image 17
  1. Type or paste 127.0.0.1 www.youtube.com in the last line. Afterward, press Control + O and press Return to save the hosts file.
How to Block YouTube on Your Mac image 18
  1. Close the Terminal window, clear your browser’s cache, and check if YouTube is blocked.

You must clear your browser’s cache after editing the hosts file in Terminal. Otherwise, you and other users will still be able to access YouTube.

To unblock YouTube, reopen the hosts file in Terminal (see steps #1 — #3) and delete 127.0.0.1 www.youtube.com. Press Control + O and press Return to save the hosts file.

How to Block YouTube on Your Mac image 19

Use Third-Party Tool

The methods above are straightforward and work on all macOS and Windows versions. Alternatively, you can block YouTube using free parental control software or your router’s admin panel.

Tags: YouTube
Share
Written by

Sodiq Olanrewaju

Read expert articles by Solanrewaju on tech, software guides, and troubleshooting solutions to improve your digital experience. <a href='https://www.online-tech-tips.com/author/solanrewaju/'>Read Sodiq's Full Bio</a>

View Sodiq's Profile

Recent Posts

  •  - personal finance tools
    10 AI Money Apps That Make Mint Look MedievalJun 6, 2025
  •  - smartwatches
    Is a Smartwatch Worth It in 2025 and Beyond?May 20, 2025
  •  - slow wifi
    How to Fix Slow Wi-Fi on Your SmartphoneMay 6, 2025
  • Programmer coding at computer. - vibe coding
    Vibe Coding 101: Your Guide to AI-Powered ProgrammingMar 26, 2025

Search

Categories

  • Gaming (345)
  • How-To (1,122)
  • News (43)
  • Reviews (438)
  • Social Media (461)
  • Streaming (174)
  • Uncategorized (4)

Popular Tags

Adobe AI Alexa Amazon Android Buying Guides ChatGPT Chrome Discord Explainers Facebook FireTV Gadget Reviews Gmail Google Google Docs Google Maps Google Sheets Home Networking Hulu Instagram Internet LinkedIn Minecraft Netflix Nintendo Switch PlayStation Premiere Reddit Remote Work Roblox Roku Roundups Smart Home Snapchat Software Reviews Spotify Steam TikTok Twitch VR WhatsApp Windows X (Twitter) YouTube

Our Publishing Family

Online Tech Tips is part of the AK Internet Consulting publishing family.

  • HELP DESK GEEK
  • THE BACK ROOM TECH
  • SWITCHING TO MAC
  • XBOX ADVISOR

Daily Email Newsletter

Connect With Us

About Online Tech Tips

Online Tech Tips has published easy-to-follow technology tutorials, honest reviews, and practical how-to guides since 2007 — helping millions of readers solve tech problems and get more from their devices.

Learn More →

© 2007-2026 Online Tech Tips.com, LLC. All Rights Reserved.

  • Home
  • About Us
  • Editorial Standards
  • Contact Us
  • Terms of Use
All systems operational