How to block websites on Windows

Complete guide with multiple methods and troubleshooting.

7-10 min read
Expert Verified
Last Updated: August 2025

Quick Answer

Blocking websites on Windows can be accomplished through various methods, including modifying the hosts file, using parental controls, or employing third-party software. Each method has its own advantages and is suitable for different scenarios.

Medium7-10 min read

Prerequisites & Requirements

Before blocking websites on Windows, ensure you have the following:
  • Windows 10 or Windows 11 installed on your computer.
  • Administrator access to modify system settings.
  • Basic understanding of navigating Windows settings and file systems.
  • Backup important data, especially if modifying system files.

Method 1: Modifying the Hosts File

This method is effective for blocking specific websites directly through the operating system. It's best used for individual users who want a straightforward solution without additional software.
  • Step 1: Open Notepad as an administrator. Search for 'Notepad' in the Start menu, right-click, and select 'Run as administrator'.
  • Step 2: In Notepad, go to 'File' > 'Open'. Navigate to C:\Windows\System32\drivers\etc. Change the file type from 'Text Documents' to 'All Files' to see the hosts file.
  • Step 3: Open the 'hosts' file. At the end of the file, add a new line with '127.0.0.1 www.example.com' (replace 'example.com' with the website you want to block).
  • Step 4: Save the file (File > Save). To verify, open a web browser and try to access the blocked website. You should see an error page.
  • Step 5: If it doesn't work, ensure you have saved the file correctly and that your browser cache is cleared.

For Windows 11

In Windows 11, the process is similar with slight interface changes.
  • Step 1: Click on the Start button, type 'Notepad', right-click, and select 'Run as administrator'.
  • Step 2: Follow the same steps to open the hosts file as described above.

For Windows 10

The steps are almost identical to those in Windows 11.
  • Step 1: Click on the Start button, type 'Notepad', right-click, and select 'Run as administrator'.
  • Step 2: Open the hosts file by navigating to the same directory.

Method 2: Using Windows Parental Controls

This method is suitable for families wanting to manage children's internet access. It allows for broader control over multiple websites and user accounts.
  • Step 1: Open 'Settings' by pressing 'Windows + I'.
  • Step 2: Click on 'Accounts', then select 'Family & other users'.
  • Step 3: Under 'Your family', select 'Add a family member' to create a child account if necessary.
  • Step 4: After adding, go back to 'Accounts', select 'Family & other users', and click on 'Manage family settings online'.
  • Step 5: Sign in to your Microsoft account and select the child account. Under 'Content restrictions', toggle 'Block inappropriate websites' and add specific sites to the 'Always block' list.
  • Step 6: To verify, log into the child account and attempt to access the blocked websites.

Troubleshooting Common Issues

If you encounter issues while blocking websites, consider the following solutions:
  • Error: 'Access Denied' - Solution: Ensure you are running Notepad as an administrator.
  • Issue: Changes not taking effect - Fix: Clear your browser cache or restart your computer.
  • Problem: Unable to save hosts file - Workaround: Check file permissions and ensure no other applications are using the file.

Advanced Tips & Shortcuts

For power users looking to enhance their website blocking capabilities:
  • Keyboard shortcut: 'Windows + R' - Opens the Run dialog for quick access to system tools.
  • Command line: 'ipconfig /flushdns' - Clears the DNS cache, ensuring changes to the hosts file are recognized immediately.
  • Hidden feature: Windows Defender Family Safety - Access through the Microsoft Family Safety app for additional monitoring and reporting.

Common Mistakes to Avoid

Avoid these common pitfalls:

Expert Tips

Using a combination of methods can provide a more comprehensive solution for blocking websites.