Fix Hosts file after Virus Attack or Invalid Modification (Solved)

The Hosts file, is a plain text file that is used to map Domain Names to IP Addresses. Hosts file entries, bypass the DNS (Domain Name System) and for that reason is used to specify a different IP Address to a website, on the computer which used. This is helpful, in cases that you want to block a specific site on your computer, or you want to work and test your new website before publishing it.

Fix Hosts file

If the Hosts file is wrong, because has been invalid modified by the user or by a malicious software, then causes Internet connectivity problems, such as re-directions to malicious websites, slow or no Internet access, etc. On all that cases you have to fix the Hosts file by resetting it to its default clean state.

How to reset HOSTS file to default settings in Windows 10, 8, 7 or Vista.

1. Press Windows image_thumb8 + R keys to open the run command box.
2. Type: notepad and press Enter.

reset hosts file


3. Select and copy the below text (in red) to Notepad. *

# 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:
#          # source server
#              # x client host
# localhost name resolution is handle within DNS itself.
#       localhost
#       ::1             localhost



* After the copy the Notepad should look like this.

reset hosts file windows


4. From the File menu select Save As.

5. Give to the new file the name hosts and delete the .TXT extension.

reset hosts file windows 10


6. Now copy or move the new hosts file to C:\Windows\System32\drivers\etc folder.

7. Select to Replace the file in the destination.

hosts file reset



8. Finally, for the changes to take effect, restart your computer or open an elevated command prompt and enter the following command: ipconfig /flushdns

hosts file fix



Important. If you hosts file has been modified by a virus, don't forget to scan and clean your computer by following this guide: How To Scan Your Computer for Viruses and other Malicious Programs (Malware Removal Guide).

That's all folks! Did it work for you?
Please leave a comment in the comment section below or even better: like and share this blog post in the social networks to help spread the word about this solution.

If this article was useful for you, please consider supporting us by making a donation. Even $1 can a make a huge difference for us in our effort to continue fighting spam while keeping this site free: