How to Reset Hosts File to Default in Windows?

UPDATE: We have released a new freeware to edit, delete and restore hosts file to default. You can download it using this link.

Hosts” file is an important system file in Windows operating system which maps hostnames to IP addresses. Its a simple text file which is stored in “C:\Windows\System32\drivers\etc\” folder in 32-bit editions of Windows OS. In 64-bit editions, it might also be stored in “C:\Windows\SysWOW64\drivers\etc\” folder.

The hosts file’s structure is very simple. It contains text lines containing IP address followed by the hostname.

Advertisement

Sometimes this hosts file is hijacked by viruses, adware, spyware or trojan horse software and is modified to redirect your web browser to various websites containing malicious code. It might also block security websites and Windows Update website in your system so that you can’t install security updates and virus definitions in your operating system.

If you are also facing a similar problem, you should check the hosts file and make sure it contains the default values. To reset hosts file to default, you can follow these simple steps:

1. Type following in RUN or Start searchbox and press Enter:

%windir%\System32\drivers\etc\

2. Now you’ll see a file with the name hosts in the opened folder.

Hosts_File_Windows.png

3. By default, Windows doesn’t allow to edit this file. So you’ll need to take ownership and full control of this file to be able to modify it.

Advertisement

You can take ownership of “hosts” file using any of following tutorials:

4. After taking ownership, open the file in Notepad and replace its content with following:

For Windows 7, Windows 8 and later:

# 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:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host

# localhost name resolution is handle within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost

For Windows Vista and Server 2008:

# 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:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host

127.0.0.1 localhost
::1 localhost

For Windows XP and Server 2003:

# Copyright (c) 1993-1999 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:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host

127.0.0.1 localhost

5. Save the file and you have reset the hosts file to default.

NOTE: If you don’t want to do it manually, you can download an automatic Fixit tool released by Microsoft to reset Hosts file to default:

Download Automatic Fixit to Reset Hosts File to Default

Thanks to our friend “Rob Margel” for sharing it…

Published in: Troubleshooting Guides, Windows 10, Windows 7, Windows 8, Windows Vista, Windows XP

About the author: Vishal Gupta (also known as VG) has been awarded with Microsoft MVP (Most Valuable Professional) award. He holds Masters degree in Computer Applications (MCA). He has written several tech articles for popular newspapers and magazines and has also appeared in tech shows on various TV channels.

Comments

NOTE: Older comments have been removed to reduce database overhead.

  1. Thank you very much!!

    It was very very helpful, I changed my host file to something else with out keeping the original backup so that I will be able to install an application. But then, the application couldn’t be installed and I lost my original host file content.
    You just saved me.

    Thanks!!

  2. i tried too but it didn´t work.
    i looked at the host-file and its the same except the copyright line…mine is written # Copyright (c) 1993-2009 Microsoft Corp.
    i have windows 8.1 with all new updates..

  3. sir my hosts file is not working… i try google block and google is block in my pc… but at that time i remove blocking site but is not working ..i think my hosts file are crashed..so kindly me guy’s

  4. this may sound lil creepy …but if you were next to i’ll give you a freaking’ kiss !! ….it work like freakin’ magic !! thnx a lot !

  5. If you delete the host file, windows creates a new file on restart and the browser works fine after the new host file is created.

  6. I have Windows 10 ( I rolled back the anniversary but still having issues accessing all https sites regardless of search site I am using, argh) I seem to not have a Host folder just IMHosts so now what?? Please help as I need my computer to economically survive. Thank you in advance.

    PS: My offline mail also is not syncing & keeps showing errors. I have had nothing but problems since updating to windows 10 🙁 Windows ppl are no help as wasted over 16hrs in 3 days & head manager was supposed to call me back but never did.
    My time/date was correct but tried resetting & restarting it but still no go 🙁
    Windows Anniversary took all my restore points & cant get them back after rolling back to Windows 10. major bandwidth hog is another large issue as I have a cap

Leave a Comment

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

NOTE: Your comment may not appear immediately. It'll become visible once we approve it.