Where to add a YouTube block in Registry Editor

To block YouTube in Windows Registry Editor, you navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\Internet Settings, then create a new string value called DisabledProtocols or modify the hosts file instead. Most people find the hosts file method simpler because it requires fewer steps and doesn't involve the registry at all — you just add an entry that redirects YouTube's domain to a local address.

The registry method works by controlling which sites Windows allows through its security policies, but it only affects Internet Explorer and Edge browsers in certain configurations. If you use Chrome, Firefox, or other browsers, changes to the registry won't block YouTube on those programs. The hosts file, by contrast, blocks YouTube at the system level for all browsers.

Key Takeaways

  • The hosts file (located at C:\Windows\System32\drivers\etc\hosts) is the fastest way to block YouTube system-wide without using the registry.
  • Registry-based blocks work primarily in Internet Explorer and Edge, and require navigating to HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\Internet Settings.
  • Adding a single line to the hosts file — 127.0.0.1 youtube.com — redirects YouTube traffic to your local computer instead of the actual website.
  • Changes to either method take effect immediately, but some browsers cache DNS lookups and may need to be restarted to see the block.

Using the hosts file instead of the registry

The hosts file is a plain text document that your computer checks before looking up a website's real address. By adding YouTube's domain to this file with a local address, you tell Windows to treat youtube.com as if it points to your own computer, which blocks access without requiring registry edits.

Open Notepad as administrator, then open the file located at C:\Windows\System32\drivers\etc\hosts. Scroll to the bottom and add two lines: 127.0.0.1 youtube.com and 127.0.0.1 www.youtube.com. Save the file with no changes to its name or format. The block takes effect immediately for most browsers, though you may need to close and reopen your browser or clear its cache.

This method blocks YouTube on all browsers and all user accounts on the computer. To reverse it, open the hosts file again, delete those two lines, and save. If you want to block YouTube only for specific user accounts rather than the entire system, the registry method gives you more control, though it requires administrator access to edit.

The registry path for Internet Explorer and Edge

If you want to use the registry instead, open Registry Editor by pressing Windows key + R, typing regedit, and pressing Enter. Navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\Internet Settings. If the Internet Settings folder doesn't exist, right-click on CurrentVersion, select New, then Folder, and name it Internet Settings.

Right-click inside the Internet Settings folder, select New, then String Value. Name it DisabledProtocols. Double-click the new entry and enter the value http://youtube.com https://youtube.com. This tells Internet Explorer and Edge to refuse connections to YouTube over both standard and secure connections.

This registry method only affects Internet Explorer and Edge browsers. Chrome, Firefox, Opera, and other browsers ignore these registry settings entirely. If you need to block YouTube across all browsers, the hosts file method is more reliable. The registry approach is useful if you want to restrict access on a managed computer where you control which browsers users can access.

Why the hosts file works better for most situations

The hosts file blocks YouTube at the operating system level, before any browser gets involved. This means the block applies to every browser, every application, and every user account on the computer. The registry method, by contrast, only affects specific browsers and requires you to know which browsers you want to block.

The hosts file is also easier to reverse. If you need to unblock YouTube temporarily, you can comment out the line by adding a # symbol at the start, then remove the # to block it again. With the registry, you have to delete the entire entry and restart your browser.

One limitation of the hosts file: it doesn't distinguish between user accounts. If multiple people use the computer, blocking YouTube in the hosts file blocks it for everyone. The registry method can be applied to specific user accounts if you navigate to HKEY_CURRENT_USER instead of HKEY_LOCAL_MACHINE, though this requires each user to have the registry entry configured separately.

What happens after you add the block

Once you add YouTube to either the hosts file or the registry, attempting to visit youtube.com will either show an error page or a blank page, depending on your browser. The browser will try to connect but receive no response (if using the hosts file) or be blocked by the security policy (if using the registry). Users cannot bypass this by typing the IP address directly, because the block applies to the domain name, not the IP.

Some browsers cache DNS lookups, which means they remember where youtube.com points to even after you've changed the hosts file. If YouTube still loads after you've added the block, close the browser completely and reopen it. If it still doesn't work, restart your computer to clear the DNS cache.

If you're blocking YouTube on a work or school computer, be aware that network-level blocks (set up by your IT department) take precedence over local blocks. A local hosts file block won't override a firewall rule set at the network level.

Removing the block later

To remove a hosts file block, open Notepad as administrator, open the hosts file at C:\Windows\System32\drivers\etc\hosts, find the lines you added for YouTube, and delete them. Save the file. YouTube will be accessible again within a few seconds.

To remove a registry block, open Registry Editor, navigate back to HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\Internet Settings, right-click the DisabledProtocols entry, select Delete, and confirm. Restart your browser for the change to take effect.

If you can't remember whether you used the hosts file or the registry, check the hosts file first — it's faster to verify. Open Notepad, go to File > Open, and navigate to C:\Windows\System32\drivers\etc\hosts. If you see youtube.com listed, that's your block. If not, check the registry using the path above.

Frequently Asked Questions

Can I block YouTube for just one user account?

The hosts file blocks YouTube for all accounts on the computer. To block it for one account only, use the registry method and navigate to HKEY_CURRENT_USER\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\Internet Settings instead of HKEY_LOCAL_MACHINE. Each user account must have the registry entry configured separately.

Will blocking YouTube in the hosts file affect my internet speed?

No. The hosts file is checked locally on your computer before any internet request is made. Blocking YouTube this way has no impact on your overall internet speed or performance.

What if I block YouTube but still see it loading?

Your browser may have cached the old DNS lookup. Close the browser completely and reopen it, or restart your computer. If you're using Chrome, you can also clear the DNS cache by typing chrome://net-internals/#dns into the address bar, clicking Clear Host Cache, and reloading YouTube.

Can someone unblock YouTube if I block it in the hosts file?

Yes, if they have administrator access to the computer. They can open the hosts file and delete the YouTube entries. If you want to prevent this, you can password-protect the hosts file or use parental control software, but a determined user with admin rights can still find ways around it.

Does the registry method block YouTube on mobile devices connected to the same network?

No. Registry edits only affect the local Windows computer. Mobile devices have their own operating systems and don't use the Windows registry. To block YouTube on mobile devices, you would need to set up a block at your router level or use parental control apps on each device.