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:
- Open Notepad as an Administrator – While logged in as an administrator, press the Windows Key and type “Notepad.”
- Notepad can be opened by right-clicking it and selecting Run as administrator.
- 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
- Open the Hosts file in Notepad by selecting File > Open or by pressing CTRL + O.
- Then, navigate to the C:WindowsSystem32driversetc folder.
- 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 (*.*)”
- To open the hosts file, double-click it.
- 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.
- To the Hosts File, add the websites you want to block.
- We will, for example, prevent the computer from accessing Facebook.
- Enter a new line, then add the following to your hosts file: 127.0.0.1 www.facebook.com.