How to Block Websites on Windows 10 & 11
In this article
To block websites on Windows 10 or 11, the most reliable method is editing the hosts file (no extra software needed) — but for easier management and to block across all browsers, you can use the built-in Parental Controls (Family Safety) or a third-party app. Below are step-by-step instructions for each approach.
What You'll Need
- An administrator account on your Windows PC.
- If using Parental Controls, a Microsoft account for the child account (free).
- If using a third-party app, an internet connection to download it from the official website or Microsoft Store.
Step-by-Step
Method 1: Using the Hosts File (Blocks on all browsers, no extra software)
- Press Windows + R, type
notepad, and press Enter. - In Notepad, go to File > Open, navigate to
C:\Windows\System32\drivers\etc, and change the file filter from “Text Documents” to “All Files”. - Select the file named hosts and click Open.
- At the bottom of the file, add a new line for each website you want to block, like this:
127.0.0.1 www.facebook.com
127.0.0.1 facebook.com
(Replace “facebook.com” with the actual domain. Include both with and without “www” to be thorough.) - Save the file (Ctrl+S). If you get a permission error, make sure Notepad is running as administrator (right-click Notepad and choose “Run as administrator” before opening the file).
- Flush the DNS cache by opening Command Prompt as administrator and typing
ipconfig /flushdns, then press Enter. - Test by visiting the blocked site in your browser. It should show an error or fail to load.
Method 2: Using Windows Parental Controls (Family Safety)
- Open Settings (Windows + I) and go to Accounts > Family & other users (Windows 10) or Accounts > Family (Windows 11).
- Click Add a family member and create a child account (you’ll need the child’s email or create a new one).
- After the child account is added, go to account.microsoft.com/family in any browser and sign in with your Microsoft account.
- Find your child’s name and click Content filters (or “Web and search”).
- Turn on the toggle for Block inappropriate websites.
- Under “Always blocked”, add the URLs of the websites you want to block (e.g.,
facebook.com). - Save changes. The block applies to the child account when they sign in on any Windows device with that account.
Method 3: Using a Third-Party App (e.g., Cold Turkey, FocusMe)
- Download and install a reputable website-blocking app from its official website or the Microsoft Store. Examples include Cold Turkey, FocusMe, or Freedom.
- Open the app and create an account if required.
- Add the websites you want to block to the block list (usually a simple text field or list).
- Set the schedule (e.g., always, or during specific hours) and activate the block.
- Follow the app’s instructions to prevent bypassing (some apps require a restart or a browser extension).
Common Mistakes
- Forgetting to run Notepad as administrator – you’ll get an “Access denied” error when saving the hosts file.
- Blocking only “www” versions – many sites work without “www”, so block both forms.
- Not flushing DNS – the block may not take effect until you flush the DNS cache.
- Using the wrong hosts file path – it must be in
C:\Windows\System32\drivers\etc, not a copy elsewhere. - Blocking the entire domain instead of a specific page – the hosts file blocks the whole domain, not individual pages.
Tips
- For hosts file blocking, use a text editor like Notepad++ to avoid encoding issues – save as UTF-8 without BOM.
- If you want to block sites on a specific browser only, consider browser extensions like BlockSite (Chrome, Edge, Firefox).
- For a quick temporary block, you can use the “InPrivate” or “Guest” mode to test if the block works.
- Remember that hosts file blocking can be bypassed by tech-savvy users (e.g., using a VPN or proxy). For strict parental control, use the Family Safety method.
- Keep a backup of your hosts file before editing – copy it to your desktop.
Troubleshooting
If the block doesn’t work:
- Check that you’ve added the correct domain (e.g.,
facebook.comnotwww.facebook.comalone). - Flush DNS again: open Command Prompt as admin and run
ipconfig /flushdns. - Restart your browser or clear its cache – some browsers cache DNS.
- Try a different browser – if the site loads in another browser, the hosts file is working but the browser might have its own DNS cache.
- If you’re using Family Safety, ensure the child is signed in with the correct Microsoft account and that the content filter is enabled.
- Check if the site is using HTTPS – hosts file blocking works for HTTP and HTTPS, but some browsers may show a warning instead of a block; that’s normal.
If you get a “Permission denied” when saving the hosts file:
- Close Notepad and reopen it as administrator (right-click > Run as administrator).
- If that fails, check if your antivirus is protecting the hosts file – temporarily disable it, save, then re-enable.
Frequently Asked Questions
Can I block a website on Windows without admin rights?
No, editing the hosts file or changing system settings requires administrator privileges. If you don’t have admin rights, you’ll need to ask the admin or use a browser extension that doesn’t require system changes.
Will blocking a site in the hosts file affect all users on the PC?
Yes, the hosts file is system-wide, so it blocks the site for every user account on that PC. For per-user blocking, use Family Safety or a third-party app.
Can I block a site only for a specific time period?
Yes, with third-party apps like Cold Turkey or FocusMe, you can set schedules. The hosts file method blocks permanently until you remove the entry.
Does the hosts file method block ads or trackers?
It can, if you add known ad/tracker domains. However, dedicated ad-blockers are more effective and maintain lists automatically.
Will blocking a site in the hosts file slow down my internet?
No, it actually speeds up access to blocked sites because the request fails immediately without going to the internet.
Can I unblock a site later?
Yes, simply edit the hosts file and remove the line(s) you added, then flush DNS. For Family Safety, remove the URL from the blocked list.