How to Block Web Pages Using Windows hosts file

Windows hosts file

In Windows, the hosts file is a text file that the operating system uses to map hostnames to IP addresses. It is located in the System 32 folder in Windows 10 at C:\Windows\System32\drivers\etc.

You can change the IP address that a given website resolves to on your computer by editing the hosts file in Windows. This enables you to override the default destination of a website’s DNS zone file.

Because these changes only affect your local machine, this web filtering method is useful for blocking websites on a personal device.

hosts File for Blocking Pages:

  1. Open Notepad as an Administrator – While logged in as an administrator, press the Windows Key and type “Notepad.”
  2. Notepad can be opened by right-clicking it and selecting Run as administrator.
  3. If your User Account Control dialog box appears, ask yourself, “Do you want to allow this app to make changes to your device?”, choose Yes
  4. Open the Hosts file in Notepad by selecting File > Open or by pressing CTRL + O.
  5. Then, navigate to the C:WindowsSystem32driversetc folder.
  6. At first, there will be nothing in this folder. To see the contents of this folder, change the drop-down menu in the bottom-right corner from “Text Documents (*.txt)” to “All Files (*.*)”
  7. To open the hosts file, double-click it.
  8. Backup the hosts file As a precaution, you can copy the text from your hosts file to a new Notepad file. If the changes you make to your host file result in unexpected behavior, simply replace the edited hosts file with the backup.
  9. To the Hosts File, add the websites you want to block.
  10. We will, for example, prevent the computer from accessing Facebook.
  11. Enter a new line, then add the following to your hosts file:


Leave a Comment

Your email address will not be published. Required fields are marked *