3 Best Host File Editor for Windows 10.
There are several ways to block websites on your Windows PC, but the easiest one is to edit your own hosts file. With a few lines of code, you can easily block any website, malware and annoying ads all over your machine. However, as simple as it sounds, the process is quite tedious, and chances are you could completely mess up the hosts file.
In general, there are many ways to edit and create host files and many popular host file editors in Windows 10. The usual way is to manually edit the hosts file, and this is how you do it.
Manually edit host files
Attention! If you are not comfortable with the huge lines of code and the idea of ​​editing configuration files, please go to next method Manually editing the hosts file is tedious because you cannot directly edit the hosts file in its original location. If you have done so, you will receive an error message like “you don’t” t have permission to save the windows 10 hosts file ″. So, we need to move it from the location below to the desktop. C: Windows System32 drivers etc
You will need administrator rights for this action
After you have moved the hosts file, double click on it. Since the hosts file has no extension, Windows doesn’t know what software to use to open it. Hence, you will see a popup asking you to select an application to open the file. Select Notepad and press Enter. You will be presented with an editable hosts file format that looks like the following screenshot.
There are now several lines of code in the hosts file with a “#” prefix. This means that the lines are commented out and do not matter. In our case, in order to block the website, we need to enter the website name with the prefix “127.0.0.1” or “0.0.0.0”. For example, if I want to block Facebook.com on my computer, I will attach the following line at the end of the file. 127.0.0.1 www.facebook.com
This line ensures that whenever I visit Facebook.com in any browser on my local system, the connection will be redirected to my own IP address. Since the web server is not running on my local system, I get a “Website Unavailable” error.
Read:Â How to Setup Free Dynamic DNS for Remote Access to Your PC
Move the file back to the “ C: Windows System32 drivers etc folder. You will get a popup asking for administrator permissions, just continue. After that, open your preferred web browser, clear your cache and now the website will be blocked across your entire system.
Cons:
- Cannot directly edit source file.
- It is not possible to have multiple host files.
- There is no way to import host files on the Internet.
1. Host file editor
The problem with the manual method is the complexity of the steps and the high probability of damage to the hosts file. To avoid the trouble, you can use the host file editor. The host file editor allows you to directly edit the hosts file without moving the original file back and forth. There are many host file editors available on GitHub, but I prefer the host file editor.
The tool is pretty simple and to the point. You have old Excel cells where you must enter the IP address followed by the website url and comments (optional). For example, below are a few entries made in the Hosts File Editor.
When you’re done recording, make sure you check the boxes next to them to make the recording active. If you leave this check box unchecked, the particular entry will be commented out in the original hosts file, rendering it ineffective. Finally, click the Save button to write the changes to the original hosts file.
The best thing about the editor is that you can turn website blocking on and off on the go with a simple click of a button. I usually had to delete or comment out every entry in the hosts file. But in the host file editor, I just need to click Disable hosts file and the blocked websites will be available. To re-enable the hosts file, click again on the same Disable hosts file option.
When you close the Hosts file editor, it is minimized, not closed. So, go to the bottom tray and exit the app.
2. Import the hosts file list
The problem with blocking websites through the Hosts file is that you have to manually enter the names of all the websites. Let’s say you want to block adult sites all over the web. Imagine how awful it would be to type 5000+ website names and IP addresses in the host file editor. The best way to handle this method is to use an existing host file over the Internet.
A great example is this GitHub page maintained by Steven Black, which is a repository of several unified hosts files. These cookies serve a variety of purposes, from blocking adult content to advertisements, malware and fake news. Now, instead of copying the hosts file directly, the best way would be to use HostsMan, the hosts file manager for Windows.
First, install the program. Then make sure you run it as administrator. Once the program starts, you will see the Select Sources button. Click on it and HostsMan will display a pop-up window with pre-populated sources.
You can read the description of the pre-filled host sources, visit their website to check the content. But, since we want to add our own source, we will have to manually record. To do this, click the “Add source” button in the lower left corner.
The next page shows blank text boxes for entering a suitable hostname and host file URL. After you have entered the URL, click the Test Connection button to test the file. You can find the URL either with a quick Google search or with this URL and scroll down at the bottom of the page to find the Host File Recipe table.
If you receive the message “This source seems compatible”, you can proceed and click OK.
HostsMan also allows you to back up your hosts file before updating. It even recognizes changes made by another tool to the hosts file.
Download HostsMan
3. Multiple hosts files
If you are using your computer for web development, chances are that you may need multiple hosts files. For example, you may need a hosts file to redirect DNS names to your own IP address, but in your specific case, you need a URL to redirect to a remote IP address. The manual way would be to create redundant entries in the hosts file followed by an appropriate comment. But having multiple host files and using a DNS switch makes things easier.
You can use a tool called Hosts Switcher. It allows you to create multiple hosts files in it and then activate a specific hosts file at a time. This simplifies the whole process, and you can even backup your hosts file using the same tool.
Load host switcher
Packaging
In general, I would highly recommend that you use HostsMan on top of any other Hosts file editor. The Hosts File Editor is ideal for one-time use. Another use case is to host the GitHub hosts file on your router so you can block websites for the entire network. Now routers don’t have the ability to dynamically update host files, so you can configure your Raspberry Pi to do the same job for you. Here is a Python script that you can run on your Raspberry Pi. It automates the task of getting the hosts file on the network and updating it on the router.
While the Host file is useful, it is limited. For example, it doesn’t allow wildcards like DNS. So, you might want to look into DNS blocking with services like OpenDNS.
For any queries or questions, let me know in the comments below.
Also read:Â How to Change DNS Server. An In Depth Guide for All Platforms
3 Best Host File Editor for Windows 10