The hosts file is the fastest website block in existence: one line of text, one computer, done. It is also the most fragile — it fails without any error message, and the user just concludes you never blocked anything. Both halves of that story are in this guide.
Every Windows PC carries a small text file that answers address lookups before DNS is even asked. Point a website's name at 0.0.0.0 in that file, and the browser can never reach the real site — on that one PC. It is perfect for a single stubborn machine and hopeless for an office of fifty. This page gives the exact steps, then the honest list of ways it quietly stops working, because with the hosts file the failure is always silent.
C:\Windows\System32\drivers\etc and change the file filter to All Files so the hosts file appears0.0.0.0 facebook.com0.0.0.0 www.facebook.com — the hosts file has no wildcardsipconfig /flushdnsUse 0.0.0.0 rather than the older 127.0.0.1 habit — it fails faster and avoids strange delays on some setups.
Reason 1: the edit never saved. Notepad opened without admin rights appears to edit the file but cannot write it. If your lines are missing when you reopen the file, this is what happened.
Reason 2: Notepad saved it as hosts.txt. If the file filter hid the real file, you may have created a new text file that Windows ignores completely. The real hosts file has no extension.
Reason 3: the browser stopped asking Windows. Chrome and Edge can use DNS over HTTPS, resolving names inside the browser and skipping the hosts file entirely. Fix: in the browser settings turn off Use secure DNS (or control it by policy) — or accept that the hosts file alone cannot hold a modern browser.
Reason 4: a VPN or proxy is running. When a VPN app connects, lookups travel through the tunnel and the local hosts file is bypassed. The user may not even think of it as cheating — it is just their remote-work tool.
Reason 5: the user is an admin. Any local administrator can simply delete your lines — and standard users in many small offices were given admin rights years ago and never had them taken back. The hosts file has no tamper protection at all.
None of these failures show an error. The site simply opens, and your block looks imaginary. Test monthly, or choose a stronger layer.
Do not throw the method away — it has honest uses:
What it is not: an office-wide system. Fifty PCs means fifty files to edit, fifty files that drift out of date, and no report when one is changed.
Treat the hosts file as tape, not a lock. The day you catch yourself editing it on a fourth PC, move up a layer: DNS filtering for the whole network in ten minutes, or an endpoint tool if the PCs are managed anyway. The steps in this series' DNS guide take less time than hosts-file edits on five machines — and they keep working after browser updates, because the control sits on the network, not inside a text file anyone can open.
See the hosts file trick in the full video — and the stronger methods to graduate to when one PC becomes fifty.
▶️ Watch Full VideoEvery hosts file question is really a why-did-it-stop question.
Check the five usual causes: the edit never saved because Notepad was not run as administrator; the file was saved as hosts.txt; the browser is using DNS over HTTPS and skipping Windows lookups; a VPN is carrying the traffic; or someone with admin rights removed the lines.
Yes. The hosts file has no wildcard support, so example.com and www.example.com are two separate entries. Miss the www line and the site opens happily through it.
Only by editing the file on every single PC, with no central management and no way to confirm they all still match. For anything beyond a couple of machines, DNS filtering or an endpoint tool is less total work and far more reliable.