Bloquer des sites web sous Windows 11 peut paraître compliqué, mais honnêtement, une fois que vous maîtrisez la modification du fichier hosts, c’est assez simple. Le plus difficile est de s’assurer que vous exécutez le Bloc-notes avec les autorisations nécessaires, car Windows est très sournois à ce niveau-là. Il arrive que des utilisateurs tentent de modifier le fichier hosts sans droits d’administrateur et soient frustrés lorsqu’il ne s’enregistre pas. Cette méthode est idéale pour bloquer rapidement quelques sites pour vous-même ou vos enfants, sans recourir à un logiciel tiers. Attention : ce blocage affecte tout le système, et affecte donc tous les navigateurs, pas seulement Chrome ou Edge. Si vous remarquez qu’un site s’infiltre malgré tout, vérifiez que les entrées sont correctes et correctement enregistrées.
Comment bloquer des sites Web sur Windows 11
Ouvrir le Bloc-notes en tant qu’administrateur
Tout d’abord, vous devez exécuter le Bloc-notes avec les droits d’administrateur. Pour cela, cliquez sur Démarrer, saisissez « Bloc-notes », faites un clic droit dessus et sélectionnez « Exécuter en tant qu’administrateur ». Parfois, Windows affiche une fenêtre de sécurité demandant l’autorisation ; il suffit d’accepter. Pourquoi est-ce important ? Parce que sans droits d’administrateur, vous ne pouvez pas apporter de modifications significatives aux fichiers système comme le fichier hosts. Sur certaines configurations, ouvrir le Bloc-notes de cette manière est étrangement délicat. Si cela ne fonctionne pas du premier coup, essayez de redémarrer le Bloc-notes en tant qu’administrateur.
Ouvrir le fichier Hosts
Une fois le Bloc-notes exécuté en tant qu’administrateur, accédez à Fichier > Ouvrir. Accédez ensuite à C:\Windows\System32\drivers\etc
. Le problème : vous ne verrez pas le fichier hosts, car la boîte de dialogue d’ouverture par défaut filtre tous les fichiers sauf les fichiers *.txt. Modifiez le menu déroulant en bas de « Documents texte (*.txt) » à « Tous les fichiers (*.*) ». Sélectionnez ensuite « hosts ». Si vous avez du mal à le trouver, vérifiez son chemin ou essayez d’abord de le copier dans un endroit plus facile d’accès. Vous devez ouvrir ce fichier pour indiquer à votre système les sites à bloquer.
Ajoutez les URL du site Web à bloquer
C’est ici que la magie opère. Faites défiler le fichier hosts jusqu’en bas et saisissez127.0.0.1 followed by a space, then the domain name of the website you want to block, like www.facebook.com. For example:
127.0.0.1 www.facebook.com
You can add multiple entries — just keep each one on its own line. For some of my setups, I’ve had to flush DNS or restart the browser, ’cause Windows is stubborn about caching DNS info. Also, note that blocking might not work immediately in some browsers; clearing cache or restarting them helps.
Save the Changes and Close the Hosts File
Once you've added all the sites, hit File > Save. Don’t mess around with anything else. Make sure you save it as a plain text file and don’t accidentally remove existing lines or add extra formatting. Close Notepad. Your changes are now in effect, but sometimes, Windows is slow to recognize them—just a heads up.
Clear Browser Cache to Make Sure the Block Works
It’s not enough to just save; browsers can cache DNS info or website data. So, go into your browser settings, find Clear browsing data, and clear cache and cookies. For Chrome, it’s under Settings > Privacy and Security > Clear browsing data. For Edge, similar menu. Restart your browser afterward. If the site still loads, try a different browser just to rule out browser cache issues.
Tips for Blocking Websites on Windows 11
- Always back up the hosts file before making changes, just in case you mess it up. To do this, copy it somewhere safe before editing.
- If blocking sites with hosts isn’t enough or gets annoying, consider parental control tools or third-party blocking software. Sometimes, hosts file tweaks are too blunt.
- Test your block by visiting the sites in multiple browsers or devices. Random browsers or refreshing might show the site still loading if you missed a step.
- Keep your hosts file updated if you decide to block more sites later. Combining this with DNS filtering or router-based solutions can be more efficient for larger setups.
- Be cautious editing system files—an easy typo can cause issues with network connectivity.
FAQs
Can I unblock websites after blocking them?
Yes, just open the hosts file again, find the lines you added, and delete them. Save, clear cache, and they should be accessible again. Easy peasy.
Does this method work for all browsers?
Yup. Windows checks the hosts file system-wide, so Chrome, Edge, Firefox, they’re all affected. No browser-specific tweaks needed.
Will it block websites on other devices?
No. This only affects the device where you edit the hosts file. To block on other devices, you’d have to repeat this process or use network-wide controls.
What if I get an error when saving?
Probably missed running Notepad as admin, or the file is still open elsewhere. Make sure Notepad has admin rights and that you close all other apps using the hosts file.
Can I block websites with keywords?
Hosting tweaks only handle specific domains. For blocking by keywords or more advanced filtering, check out third-party tools like parental control apps or network filters.
Summary
- Open Notepad as Administrator
- Navigate to C:\Windows\System32\drivers\etc
- Open the hosts file
- Add entries like 127.0.0.1 www.example.com
- Save and close
- Clear browser cache
Wrap-up
This method is kind of a classic but still super effective way to block websites on Windows 11. It’s not perfect—browsers or apps might cache DNS info for a bit—but for quick blocking, it works well. Just remember, messing with system files always comes with a risk, so backups are your friend. Once you get the hang of it, you can have some control over the web experience without relying on external programs. Fingers crossed this helps someone save a few hours of confused troubleshooting.