Last updated on February 28th, 2018
The HOSTS file (C:\Windows\System32\drivers\etc\hosts), is a plain text file that is used in operating systems (Windows, Mac, Linux, etc.) to map hostnames to numerical IP Addresses. The hosts file can override DNS and redirect websites to different locations.
Sometimes users modify the hosts file in order to block unwanted sites or to reach specific sites faster (increase Internet Speed). In other cases the hosts file may be incorrectly modified (compromised) by a malicious program to prevent Internet access or to redirect users to malicious content (URLs).
For all these cases, there is the need to restore the hosts file to its default settings (values) in order to resolve Internet connectivity problems.
In this tutorial you can find instructions on how to check hosts file's integrity and how to reset host file to its default state.
How to Check and Restore HOSTS file's integrity.
Step 1. Check HOSTS's file integrity.
1. Open Windows Explorer and navigate to this location on your disk:
2. Right click at hosts file and select Open.
3. From the list of programs select the Notepad and click OK.
4. If, when opening the hosts file, you see the screen below (Screenshot No1), that means that the hosts file is untouched and there is no need to modify or restore it to its default state.
[Screenshot No1. Default (Unmodified) hosts file]
5. In the case that the hosts file has been modified incorrectly by you or by a malicious program, then you should see additional entries at the end of the hosts file (Screenshot No2). In that case proceed to the next step and reset the hosts file to its original settings. *
*Note: If the hosts file has not modified by you, then after restoring it to its default values, perform a virus scan.
[Screenshot No2. Modified hosts file]
Step 2. Restore HOSTS file to Default.
You can restore/reset the hosts file to its default (original) settings, by using two methods:
Method 1. Automatically Reset HOSTS file with Host Mechanic Freeware utility.
* Note: Some security software might show that the Host Mechanic is unsafe, when you try to download or run this software. Please ignore the message, it's a false positive, since this tool tries to modify a system file. On the other hand, if you feel uncomfortable to run this file, then proceed to Method-2 below and restore manually the HOSTS file.
2. Extract the downloaded zipped file (Host-Mechanic.zip)
3. Run Host Mechanic application.
4. Click at Restore Default Host File button.
5. Close Host Mechanic and restart your computer.
Method 2. Manual Edit and Restore HOSTS file.
To manual reset (restore) hosts file to its default values:
1. Navigate to C:\Windows\System32\drivers\etc folder.
2. Copy the hosts file to your desktop. To do that:
a. Right click at the hosts file and select Copy.
b. Then right click at an empty space on your desktop and select Paste.
3. Right click at the hosts file (on your desktop) and select Open.
4. From the list of programs select the Notepad and click OK.
5. Select the text below and press Ctrl + C (Copy).
# Copyright (c) 1993-2006 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
6. Go to the open "host – Notepad" window and erase anything on it. [press Ctrl + A and press Delete (Del)].
7. Then press Ctrl + V to paste the above – copied – text.
* The hosts file should look like this:
8. From the File menu, select Save and then close the "host – Notepad" window.
9. Finally, copy the hosts file from your desktop and paste it back to "C:\Windows\System32\drivers\etc" folder. *
10. Choose Copy and Replace when asked.
11. Restart your computer.
That's it! Let me know if this guide has helped you by leaving your comment about your experience. Please like and share this guide to help others.