How to reset Hosts file back to default in Windows 10

The Hosts file in Windows 10/8/7, is used to map host names to IP addresses. If for some reason, you find that your Hosts file has been compromised and that some malicious entries have been added, you can if you wish, reset Hosts file back to default.

Reset Hosts file

Reset Hosts file in Windows 10

The Hosts file in Windows 10/8/7 is located at the following location:


To reset the Hosts file, open File Explorer, type the following in the address bar and hit Enter:

%systemroot% \system32\drivers\etc

Rename the Hosts file to hosts.bak. You may be required to take ownership of the file first.

Next, create a new default Hosts file. To do so, open a new Text file named hosts in the folder %WinDir%\system32\drivers\etc folder.

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

Save the text file.

Download default Windows Hosts file

Alternatively, if you wish you can download the default Hosts file of Windows 10/8/7 by clicking here. Extract the contents and place the Hosts file in your C:\Windows\System32\drivers\etc folder. You may be asked for permissions to replace it.

HostsMan is good freeware utility that lets you add, remove the entries and generally lets you manage the Hosts File in Windows easily. Go here to see how you can Lock, Manage, Edit Hosts File in Windows.

Posted by on , in Category Security with Tags
Anand Khanse is the Admin of, a 10-year Microsoft MVP Awardee in Windows (2006-16) & a Windows Insider MVP. Please read the entire post & the comments first, create a System Restore Point before making any changes to your system & be careful about any 3rd-party offers while installing freeware.


  1. whatdoesitwant

    I checked, but on my windows 7 RC build 7100 hosts does not live in %systemroot% \SysWOW64\drivers\etc.
    It does exist in %systemroot% \system32\drivers\etc however.

    Am I correct to assume that I should no longer set up my localhost aliases in the hosts file but rather directly in the dns client of the Microsoft Management Console (gpedit). If so, how?

  2. david

    i think it’s not good solution because host file is configure as default setting. Rename host file may be crash system. My good solution is

    1. Open Notepad with Administrative privileges by clicking Start, All Programs, Accessories, and then right-click Notepad and select to open as Administrator.
    2. Now that Notepad is open with Administrative privileges browse to (C:\Windows\System32\drivers\etc) in Notepad and open the hosts file.

  3. You can set up localhost aliases in the hosts file.

    In x86, Hosts file is situated in %systemroot% \system32\drivers\etc folder.

    This is the recommended way to set the Hosts file to default.

    Incidentally, there is now also a ready FixIt solution from Microsoft here: .

  4. Ensar DEM?RKOL

    Thank you so very much.

  5. carlos calderón

    Aparently this is supposed to fix the problem that i can´t install ublock or adblock plus because an adware messed up everything in my computer. I performed the instructions above and the same error appears. Any suggestions?

  6. Turlututu

    Same problem there…

  7. blink ? -.-

    i just found a sh*tton of trojans and PUPs with a trusted malware detector. nasty little buggers!

    this is an old solution, so i’m not sure if it works still, but if you found this, it means that you were probably in the (adblockplus . org) help forums. keep trying the other suggestions… best of luck to everyone!

  8. IOSmurdersANDROIDandWindows

    does the copyright year matter I’m using windows 10 build 10240

  9. Joseph

    what type of file should i save it under?! just leave it as Text Document???

  10. Ihsan 2594

    Thanks You 😀 😀

  11. xXTuff-PegasisterXx

    I’m having a DNS server issue and have tried everything.
    Someone suggested this on one of the DNS server fixing videos and I came here.
    I want to ask, is it a good or a bad idea to delete the files in the etc. folder? Many people have been saying that and I was curious.

  12. Harsh Shetty

    You are a god send. Thank you so much.

  13. Derek Castro

    It worked

Leave a Reply

Your email address will not be published. Required fields are marked *

8 + 8 =