How to block a website in Windows 10 and 11 (step by step)
This tutorial will show you step by step how to block a website in Windows 10 and 11 by adding a few lines to the Windows hosts file using Notepad.
You don't need third-party software to block websites in Windows 10 or 11. You can do this by adding a few lines to the Windows hosts file using Notepad.
The website will be blocked in all web browsers (e.g., Google Chrome, Microsoft Edge, Mozilla Firefox, Brave, Opera, etc.).
How to block a website in Windows 10 and 11 using hosts file
- Click on the Windows start menu button.
- Type notepad.
- Right-click on Notepad when it appears in the search results.
- Click Run as administrator.
- If the 'User Account Control' window appears, you click Yes. Depending on your settings, you may also need to enter the admin password and click Yes.
- Click File located in the top left corner of Notepad.
- Click Open.
- Navigate to the following location on your PC: (C:) > Windows > System32 > drivers > etc.
- Click Text Documents (*.txt) located in the bottom right corner of Notepad.
- Select All Files (*.*).
- Select the hosts file.
- Click Open.
-
Add the following lines underneath localhost name resolution is handled within DNS itself:
127.0.0.1 www.example.com 127.0.0.1 example.com
- Click File located in the top left corner of Notepad.
- Click Save.
- Close Notepad.
The website is now blocked in all web browsers by the hosts file in Windows 10 or 11.