• Skip to main content
  • Skip to primary sidebar

Master Your Tech

Mobile phones, software, consumer electronic how-to guides

  • iPhone
  • Excel
  • Powerpoint
  • Word
  • Google Drive
  • Tech
  • Guides
You are here: Home / Guides / How to Block a Website on Windows 10: A Step-by-Step Guide

How to Block a Website on Windows 10: A Step-by-Step Guide

posted on June 23, 2025

Blocking a website on Windows 10 can be a breeze. All you have to do is tweak the hosts file on your computer. This little file acts like a map, directing your computer where to go online. By adding a line in this file, you can tell your computer to block any website you choose. Just follow these simple steps to take control of your online experience.

How to Block a Website on Windows 10

Blocking websites on Windows 10 can help keep distractions at bay or protect young users from inappropriate content. Follow these steps to block a website using the hosts file on your computer.

Step 1: Open Notepad as Administrator

Open Notepad with administrative privileges by right-clicking on the Notepad icon and selecting "Run as administrator."

Running Notepad as an administrator is crucial because the hosts file is a system file, and you’ll need admin rights to make changes. If you skip this part, you might not be able to save your changes later.

Step 2: Locate the Hosts File

Navigate to C:WindowsSystem32driversetc in Notepad and open the hosts file.

The hosts file doesn’t have an extension, so when you open it, you may need to set Notepad to show "All Files" to find it. This file contains mappings of IP addresses to hostnames.

Step 3: Add Website to Block

Add a new line at the end of the file: 127.0.0.1 www.blockedwebsite.com.

This step is where the magic happens. By associating the website’s URL with the IP address 127.0.0.1, you’re essentially redirecting the browser to your own computer, which doesn’t host the website.

Step 4: Save and Exit

Save the changes by going to File > Save, then close Notepad.

Make sure to save the file with the same name and format. If done correctly, the hosts file will now have an additional entry that redirects the specified website.

Step 5: Clear DNS Cache

Open Command Prompt and type ipconfig /flushdns, then hit Enter.

Flushing the DNS cache ensures that Windows uses the updated hosts file. Without this step, your computer might still try to use the previous DNS settings, allowing access to the blocked site.

Once you complete these steps, the website you added to the hosts file will be blocked. If you try to visit it, your browser will display a "site cannot be reached" error instead.

Tips for Blocking a Website on Windows 10

  • Make sure to run Notepad as an administrator; otherwise, you can’t edit the hosts file.
  • Always double-check the website URL you enter to avoid blocking the wrong site.
  • Consider backing up your hosts file before making changes in case you need to revert them later.
  • If you want to unblock the site later, just delete or comment out the line you added.
  • Be cautious when editing system files to avoid any unintended issues.

Frequently Asked Questions

Can I block multiple websites at once?

Yes, you can add multiple entries in the hosts file, each on its own line, to block more than one website.

Is there an easier way to block websites?

Third-party software offers user-friendly interfaces for blocking sites, but editing the hosts file is a faster, no-cost method.

Will this affect other users on the same network?

No, changes to the hosts file only affect the computer it’s on, not other devices on the network.

Can I block websites on a schedule?

The hosts file method doesn’t support scheduling; for that, consider using parental control software.

What should I do if I make a mistake?

If you encounter issues, restore your backup of the hosts file or remove the problematic entries.

Summary

  1. Run Notepad as Administrator.
  2. Navigate to the hosts file location.
  3. Add website to block.
  4. Save and exit Notepad.
  5. Clear the DNS cache.

Conclusion

Blocking a website on Windows 10 using the hosts file is a straightforward and effective way to manage your internet browsing experience. Whether you’re trying to minimize distractions or protect younger users from unsuitable content, these steps provide a simple solution. As you become familiar with adjusting the hosts file, you’ll gain greater control over the sites accessible on your computer.

Remember, technology is like a double-edged sword. While it offers countless benefits, it also requires mindful use. By learning how to block a website on Windows 10, you’re taking a proactive step in managing your digital environment. If you want to explore more advanced options, consider diving into third-party software solutions that offer additional features and customization. But for a quick, no-cost approach, editing the hosts file is your go-to method.

Matthew Burleigh
Matthew Burleigh

Matthew Burleigh has been a freelance writer since the early 2000s. You can find his writing all over the Web, where his content has collectively been read millions of times.

Matthew received his Master’s degree in Computer Science, then spent over a decade as an IT consultant for small businesses before focusing on writing and website creation.

The topics he covers for MasterYourTech.com include iPhones, Microsoft Office, and Google Apps.

You can read his full bio here.

Share this:

  • Click to share on X (Opens in new window) X
  • Click to share on Facebook (Opens in new window) Facebook

Related posts:

  • How to Favorite a Website on iPhone 13: A Step-by-Step Guide
  • How to Create a Desktop Shortcut to a Website from Chrome: A Step-by-Step Guide
  • How to Block a Caller on the iPhone 15: A Step-by-Step Guide
  • How to Block a Contact on an iPhone 14: Step-by-Step Guide
  • How to Block this Caller on an iPhone 14: A Step-by-Step Guide
  • How to Block Websites on iPhone 14: A Step-by-Step Guide
  • How to Block Text Messages on iPhone 13: A Step-by-Step Guide
  • How to Block a Number on iPhone 15: Step-by-Step Guide
  • How to Block a Contact on iPhone 14: A Step-by-Step Guide
  • How to Block Cookies on iPhone 14: A Step-by-Step Guide
  • If I Block a Number from Calling Me on My iPhone, Will Texts Be Blocked Too?
  • If I Block Someone On iPhone, Will They Be Notified? Find Out Here!

Filed Under: Guides

Search

Primary Sidebar

Latest Posts

  • How to Hard Reset PC Windows 11: A Step-by-Step Guide
  • How to Change Font Size on Computer Screen in Windows 10 Easily
  • How to Clear Temp Files in Windows 10: Quick and Easy Guide
  • How to Record in Windows: A Step-by-Step Guide for Beginners
  • How to Make a Shortcut on Windows 10: A Step-by-Step Guide
  • Contact Us
  • Privacy Policy
  • Terms and Conditions

Copyright © 2026 MasterYourTech.com