To block a website on your Windows 10 PC, open Notepad as an administrator, open the hosts file in C:\Windows\System32\drivers\etc, and add a line like 0.0.0.0 www.example.com. Save the file, and the site stops loading in every browser on that PC. To unblock it, delete the line.
Applies to: Windows 10. Checked against Microsoft Support on September 27, 2026.
Block a website with the hosts file
- Select Start, type Notepad, right-click it, and select Run as administrator.
- Select File > Open, go to C:\Windows\System32\drivers\etc, change Text Documents to All Files, and open hosts.
- At the bottom, add one line for each site, like this:
0.0.0.0 www.example.com
- Add a second line without www., like
0.0.0.0 example.com, so both versions are blocked. - Select File > Save.

- Close and reopen your browser. If the site still opens, run
ipconfig /flushdnsin Command Prompt.
For more about this file, see how to edit the hosts file in Windows 10.
Unblock a website you blocked
Open the hosts file the same way, delete the line for that site (or type # at the start of it), and save. Then close and reopen your browser.

Block websites for a child’s account
If you want to filter websites for your kids, use Microsoft Family Safety. Its web filters work in Microsoft’s browser, and you can allow or block sites from the Family Safety website or app. See how to set up parental controls in Windows 10.
Frequently asked questions
Can I block a website on every device in my home?
Yes, many routers can block websites for the whole network. Look for Parental controls or Access control in your router’s settings.
Can I block an app from the internet instead?
Yes. See how to block an application from accessing the internet in Windows 10.
Why can’t I save the hosts file?
Notepad needs to run as an administrator. See how to run a program as administrator in Windows 10. Some security apps also protect the file.
A website is blocked at work or school. Can I unblock it?
Those blocks are set by the network’s owner. Ask your IT team or teacher if you need access.
Microsoft’s reference is Filter websites and searches using Microsoft Family Safety. More help is on our Windows Help & Guides page.

Matt Jacobs has been working as an IT consultant for small businesses since receiving his Master’s degree in 2003. While he still does some consulting work, his primary focus now is on creating technology support content for SupportYourTech.com.
His work can be found on many websites and focuses on topics such as Microsoft Office, Apple devices, Android devices, Photoshop, and more.