A Hosts file is a file that contains specific IP addresses and domain names. It is used for testing purposes to override a DNS (Domain Name System) so that a web browser can be redirected to a specific IP address. For some users, the Hosts file is not working properly on their Windows 11/10 systems. If such a thing is happening to you, you can try the solutions explained in this article to fix the problem.
Why Hosts file is not working?
There could be many reasons for which the Hosts file is not working on your Windows computer. You might be using the wrong format in your Hosts file. Apart from that, permission issues of the Hosts file are also one of the causes. If you have configured Proxy on your Windows 11/10 computer, it might be bypassing the Hosts file. We have explained the solutions to deal with this problem below in this article.
Hosts File not working in Windows 11/10
Before you try the solutions mentioned below, make sure that you are using the correct format in the Hosts file to redirect websites in your web browser. The Hosts file will not work if you have added the websites in the wrong format. The correct format is as follows:
IP Address www.abcd.com
There is a space between the IP address and the domain name. You can also separate the IP address and the domain name with Tab if separating them with space is not working.
Also, the same IP address should not be on different lines. If you want to add multiple entries for the same IP address, you can add all these entries in the same line by separating them with space.
If you have used the right format but still the Hosts file is not working, try the solutions mentioned below:
- Flush your DNS cache
- Reset your NetBios cache
- Check the encoding format of the Hosts file
- Check for permission issues
- Reset the Hosts file
- Disable Proxy
- Create a new Hosts file
- Flush Socket Pools in Chrome
- Disable DoH in Firefox
Let’s see all these fixes in detail.
1] Flush your DNS cache
The changes made to the Hosts file should take effect immediately. But this is not happening. Hence, flushing the DNS cache can fix the problem. To do so, you have to execute the following command in an elevated Command prompt.
2] Reset NetBios cache
If flushing the DNS cache did not fix your problem, resetting the NetBios cache may help. Open the Command Prompt as an administrator, type the following command, and hit Enter.
Now, check if the issue persists.
3] Check the encoding format of the Hosts file
The Hosts file should have any one of the following encoding formats:
Check what the encoding format of your Hosts file has. To do so, right-click on the Hosts file and select “Open with > Notepad.” If the Notepad option is not there, open Notepad and then press the Ctrl + O keys. Now, select the Hosts file to open it. Go to “File > Save As.” Notepad will show you the same encoding format used for the Hosts file.
Alternatively, you can also use Firefox to view the encoding format of the Hosts file. The steps to do so are as follows:
- Open Firefox.
- Press the Ctrl + T keys to open a new tab.
- Press the Ctrl + O keys and select the Hosts file to open it in Firefox.
- When the Hosts file opens up in Firefox, press the Ctrl + I keys to view the encoding format.
If the encoding format is other than those mentioned above, you can change it by using Notepad. Open the file in Notepad and go to “File > Save As.” Select UTF-8 or ANSI encoding format in the drop-down. Write its name under inverted commas, as “hosts” and click Save. You will get a confirmation message to replace the existing file. Click Yes.
If this does not work, create a new Hosts file. We have explained this method later in this article.
4] Check for permission issues
The problem might be occurring due to permission issues. The Hosts file should have both Read and Read & execute permissions. To check this, follow the steps listed below:
- Right-click on the Hosts file and select Properties.
- When the Properties window appears, select the Security tab.
- Select Users in the Groups or user names box.
- Both Read and Read & execute permissions should have check marks under the Allow column. If not, allow these two permissions to the Hosts file by clicking on the Edit button.
5] Reset the Hosts file
If the issue still persists, reset the Hosts file back to default. Resetting the Hosts file to default can fix the connectivity issues.
6] Disable Proxy
If Proxy is enabled on your computer, it might be bypassing the Hosts file due to which the Hosts file is not working. The solution is to disable the Proxy. Open your Windows 11/10 Settings and turn off both Automatic proxy setup and Manual proxy setup settings.
7] Create a new Hosts file
Create a new Hosts file and replace the existing one with that. Before you create a new Hosts file, we suggest you perform the following steps and see if the issue is fixed.
- Go to the default location where the Hosts file is located.
- Copy the Hosts file and paste it to another location.
- Delete the Hosts file from the original location.
- Now, go to the location where you copied the Hosts file and move it to the original location.
The above steps solved the problem of some users. Maybe these steps solve your problem too. If this does not help, create a new Hosts file. To do so, go through the following steps:
- Open the default location of the Hosts file.
- Right-click on the Hosts file and select Rename.
- Name it as Hosts.old and hit Enter. You should sign in to your computer as an administrator to rename the Hosts file.
- Now, open Notepad.
- Go to “File > Save As.”
- In the File name field, type hosts under the inverted commas.
- Make sure that the encoding format is set to either UTF-8 or ANSI.
- Now, click Save.
- Move this Hosts file to the default location on the C drive (if you have saved it on another location).
8] Flush Socket Pools in Chrome
The connectivity issues in Chrome can also be resolved by flushing the Socket Pools. If clearing the DNS cache on your Windows device does not fix the problem, you can also try flushing the Socket Pools in Chrome. To do so, open Chrome, then open a new tab. Now, copy the following address, paste it into the address bar of Chrome, and hit Enter.
Click on the Flush socket pools button.
9] Disable DoH in Firefox
DoH stands for DNS over HTTPS. It is a protocol that passes the DNS queries through an HTTPS encrypted session. If privacy is your main concern, you can enable this setting in Firefox. When you type the address of a particular website, your web browser sends a request over the internet to look up the IP address of that website. If this connection is not encrypted, the web address can easily be seen by third parties. If DoH is enabled, the request is sent to the DoH-compatible DNS server by using the encrypted HTTPS connection.
The DoH can be slower than traditional DNS queries. If DoH is enabled in Firefox, you might be experiencing the issue due to it. You can check this by disabling it. The steps for the same are as follows:
- Open Firefox.
- Click on the three horizontal lines on the top right side and select Settings.
- Select the General category from the left side.
- Scroll down and locate the Network Settings section. Click on the Settings button under this section.
- The Connection Settings window will appear.
- Scroll down and uncheck the Enable DNS over HTTPS checkbox.
- Click OK to save the changes.
How do I open Hosts file in Windows 11?
You can open Hosts file in Windows 11 by using text editor software. Notepad has a default text editor software in Windows. You can use it or you can install Notepad++ for the same. To open a Hosts file in Notepad, first, open Notepad as an administrator, press the Ctrl + O keys, and select the Hosts file to open it.
Hope this helps.