Are you having problems with your Windows hosts file? Does it seem like it’s not working properly and that your computer is not able to communicate with certain websites and servers? If so, don’t worry – you’re not alone.
In this blog post, we will discuss how to fix the Windows hosts file if it is not working properly. We will also provide some tips on how to prevent this from happening in the future.
To fix various Windows 10 problems, we recommend Outbyte PC Repair:
This software will repair common computer errors, protect you from file loss, malware damage, hardware failure, and optimise your computer for peak performance. In three simple steps, you can resolve PC issues and remove virus damage:
- Download Outbyte PC Repair Software
- Click Start Scan to detect Windows 10 issues that may be causing PC issues.
- Click Repair All to fix issues with your computer's security and performance.
This month, Outbyte has been downloaded by 26,078 readers.
What are Windows Hosts Files?
Before we get into how to fix the Windows hosts file, let’s first take a step back and understand what it is.
Windows hosts files are used to map IP addresses to hostnames. This means that when you type in a certain website or server name, your computer will know which IP address to connect to.
The hosts file is a plain text file and does not have a file extension. The hosts file is located in the following location: C:\Windows\System32\drivers\etc
Inside the hosts file, you will see a list of IP addresses and hostnames. Here is an example:
- 127.0.0.0 localhost
- :: localhost
- 192.168.0.100 my-website.com
The first two lines are reserved for loopback addresses. The third line is an example of mapping a hostname to an IP address.
In this case, when you type in my-website.com into your web browser, your computer will know to connect to the IP address 192.168.0.100.
You can also add comments to the hosts file by using the # sign. Anything after the # sign on a line will be ignored by your computer.
Now that we understand what Windows host files are and how they work let’s take a look at how to fix them if they are not working properly.
Why Hosts file not working?
There are a few reasons why your Windows hosts file might not be working properly.
- The most common reason is that the hosts file is corrupt or has been modified by a malicious program. If this is the case, you will need to restore the hosts file to its default state.
- Another reason why your hosts file might not be working is that it is being blocked by your firewall. If this is the case, you will need to allow access to the hosts file in your firewall settings.
- One more reason why your hosts file might not be working properly is because of DNS caching. DNS caching can cause your computer to hold onto old DNS records and not use the updated hosts file
- Finally, if you are using a VPN or proxy, this can also cause problems with the Windows hosts file.
How to Fix Windows Hosts File Not Working?
There are a few different things that can cause the Windows hosts file to stop working properly. We will go over each of these below.
Perform basic Troubleshooting
Before doing anything in advance, first, you should perform some basic troubleshooting steps:
- Make sure the hosts file is named correctly. Double-check that it’s called hosts and not host or anything similar.
- Make sure that the file does not have any extension like .txt,.doc, or anything else.
- Users reported that the problem was caused by line endings, so changing the line endings to Windows format might fix things. Typically, the white space causes problems since it’s impossible to spot.
- The hosts file should be encoded in ANSI or UTF-8 without the BOM. You may accomplish this by choosing File -> Save As.
Reset the Hosts File to Default
If you have made changes to your hosts file and you are having problems or if the hosts file is corrupted, one thing you can try is resetting the hosts file back to its default state.
For that, follow these instructions:
- On your Windows search box, type Notepad and click on its icon to launch.
- Copy the following text and paste it into the Notepad file:
- # Copyright (c) 1993-2009 Microsoft Corp. # # This is a sample HOSTS file used by Microsoft TCP/IP for Windows. # # This file contains the mappings of IP addresses to host names. Each # entry should be kept on an individual line. The IP address should # be placed in the first column, followed by the corresponding host name. # The IP address and the host name should be separated by at least one # space. # # Additionally, comments (such as these) may be inserted on individual # lines or following the machine name denoted by a ‘#’ symbol. # # For example: # # 22.214.171.124 rhino.acme.com # source server # 126.96.36.199 x.acme.com # x client host # localhost name resolution is handle within DNS itself. # 127.0.0.1 localhost # ::1 localhost
- Save this file on the desktop with the name hosts.
- Now copy this newly created file and paste it into the following location: C:\Windows\System32\drivers\etc.
- Replace the already existing hosts file.
Flush Old DNS Cache
If you’ve made changes to your hosts file and you are still having problems accessing the site, one thing you can try is flushing your DNS cache. This will clear out any old entries and force your computer to re-read the hosts file.
To do this, follow these instructions:
- On the Windows search box, type cmd and click on its icon to launch.
- At the command prompt, type ipconfig /flushdns and press Enter.
- You should see a message that says “Successfully flushed the DNS Resolver Cache.”
- Exit out of the Command Prompt.
- Restart your computer.
Add exceptions to Proxy
If you’re using a proxy server, sometimes that can cause issues with the hosts file not working properly. In this case, you will need to add an exception to your proxy settings for the site that you are trying to access.
To do this, follow these instructions:
- On the windows search box, type change proxy settings and click on its icon to launch.
- If the Automatically detect settings option is enabled, then you aren’t using a proxy.
- If you do use one, you could add exceptions by returning to Connections -> LAN settings.
- Select Proxy Server / Advanced next.
- You may now add your exceptions to the Exceptions text box.
A non-working hosts file can restrict you from accessing certain websites and can disturb your workflow. In this post, we showed you how to fix this problem on Windows.
We hope that this article was helpful and that you were able to fix the hosts file not working problem. If you have any other suggestions or questions, leave us a comment below.
The hosts file is a local file that maps hostnames to IP addresses. This file is used by your computer to resolve hostnames to IP addresses without going through a DNS server.
There are several reasons why your hosts file might not be working. The most common reason is that the hosts file is corrupted or has been modified incorrectly. Other reasons can include using a proxy server or having old DNS cache entries.
Peter is an Electrical Engineer whose primary interest is tinkering with his computer. He is passionate about Windows 10 Platform and enjoys writing tips and tutorials about it.