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.

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.

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...





Share this article: Facebook | Twitter | Google+ | Reddit | Tell a friend

Posted in: Troubleshooting, Windows 10, Windows 7, Windows 8 / 8.1, Windows Vista, Windows XP


Other similar articles that may interest you


Comments

  • windows vista, will not let me save. says cannot create the file

  • Just run the notepad-like software as administrator.

  • 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!!

  • OMG thank you so much. For those who cannot seem to get adminstrator rights, download "take ownership" its a program that allows you to take adminstrators rights over a program. After downloading, just right click on hosts and select take ownership

    http://www.askvg.com/add-take-ownership-option-in-file-folder-context-menu-in-windows-vista/

  • Thank you very much. It really helped me to restore my hosts file.

  • 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..

  • 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

  • great man thanks

  • 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 !

  • 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.

Leave a Comment

(required)