Let’s keep this brief! You want to know how to block a website. This might be for you, your kids or just to block a dodgy website.
You can also read this on Medium.
Latest Posts
How to Optimise MySQL 8.4 on Windows
5 months since my last post! That’s what having a full-time job and a third…
How to Upgrade MySQL Community to MySQL Enterprise on Red Hat 9
Been a while since I made a post, so let’s jump straight back in with…
How to Setup WordPress Backups (FREE!)
Personally, I like my website. A lot. And I wouldn’t want one mistake to make…
Install NGINX on an Offline RHEL System – 2 Systems Required!
Been a while since my previous post, but let’s hope the magic hasn’t rubbed off…
MySQL 8.4 Replication with SSL on Ubuntu 22.02
So I recently wrote a post and made a YouTube video on setting up MySQL…
Gutenberg Just Broke my Website
More of a story and vent than an informative article. So to save you reading…
Introduction
But as a TL:DR – This article is only useful is you are using Windows.
How To Block A Website On Windows
Personally, this would be my favourite method as it has a number of advantages:
- Scope – Blocking a site for your entire operating system means that the website will be unavailable for any web browser you use. Whereas blocking a site in a particular web browser would still allow other browsers and services on your machine to access the website. To set a block up for your entire network, consider using PiHole
- Ease – If you know your way around a computer, then I think it’s the easiest option as it’s simply a case of updating a single notepad
- Speed – Rather than downloading a separate program or extension, you simply set the values and save the file. So fast!
However, there are some downsides. For example: you will need to have administrator access to the machine in order to update and save the file. You might also find this method a bit too advanced if this is your first day using a computer; but how likely is that?
Enough setup, let me show you how to block websites on Windows:
Step 1
Search for notepad and right click the program, from the options displayed make sure to choose Run as administrator:

Step 2
One Notepad is open as the administrator, you need to go to File -> Open and then open the file in this location:
C:\Windows\System32\drivers\etc\hosts
It’s worth noting here that the hosts file might not show up due to the file type filtering. If this is the case, please select All Files (*) instead of Text Documents (*.txt)
Step 3
Finally, you can enter the websites you want to block. The values can be as specific as you want. But the overall goal is to send traffic destined for https://facebook.com to 127.0.0.1 which is the local linkback address. Effectively meaning the request for Facebook goes nowhere.
I’ll leave below some examples that you can add to your hosts file:
Once you’ve setup your hosts file, you can use File -> Save.
And that’s it, you should have now blocked access to whatever sites you want to the entire machine.
I hope you learnt something whilst reading this!
Enjoy! 🎉