Block a website on Windows 11 without installing anything

You want to block access to certain websites on your computer Windows 11 ? This article explains how to do it, in a few simple steps, without needing to install any specific software.

The key is in editing the file “ hosts » of your system Windows 11.

The "hosts" file is a text file that is used by the operating system to resolve domain names into IP addresses. By adding an entry to this file, you can force the browser to redirect a request to an incorrect IP address. This will block access to the website corresponding.

Note that this method works on Windows 11 but also on all versions of Windows and with all the browsers you have on your machine.

But how exactly to do this?

For block a website with the “hosts” file, follow these steps:

  • Start by clicking on the central button on the taskbar (the logo Windows) and type “ notepad“. Then right-click on “ Notepad » in the results and select “ Execute as administrator"

    Launching Notepad in administrator mode
  • When Notepad opens with administrator rights, click “ File "And then" Open"
  • Then head to C:\Windows\System32\drivers\etc and, in the lower right corner, change the filter from “Text Files (*.txt)” to “All Files”.

    Open the host file from Notepad
    Open the host file from Notepad
  • Select the file hosts and open it.
  • Add the following line to the file, replacing "www.example.com" with the address of the website you want to block:
    127.0.0.1 www.example.com
Contents of the hosts file Windows 11
Contents of the hosts file Windows 11
  • If you want to block multiple sites, continue adding a new line for each site, always starting with “ 127.0.0.1“, then a space, and finally the site address.
  • Finally, save your changes by clicking on “ File "Then" Save", before closing the notepad.

For example, if you want to block Facebook, just add these lines:

  • 127.0.0.1 facebook.com
  • 127.0.0.1 www.facebook.com
  • 127.0.0.1 login.facebook.com
  • 127.0.0.1 web.facebook.com
  • 127.0.0.1 static.ak.fbcdn.net
  • 127.0.0.1 b.static.ak.fbcdn.net

Small technical clarification: the address “ 127.0.0.1 » represents the local address of your computer. It is this address which, in a way, “redirects” the request to a dead end, thus preventing access to the site.

After these additions, save your changes.

Well done ! When you try to access these sites, an error message will appear in your browser.

Facebook inaccessible on this computer
Facebook inaccessible on this computer

Have you changed your mind ?

To unblock a site, simply open the hosts file again and delete the lines corresponding to the addresses you want to make accessible again.