UPDATE: A freeware is also available to do this task automatically. Check this link to download it.
"Hosts" file is an important system file in Windows which maps hostnames to IP addresses. Its a simple text file which is stored in "%windir%\System32\drivers\etc\" folder in Windows NT, 2000, XP, Server 2003, Vista, Server 2008 and Windows 7 32-bit editions. In 64-bit editions, it might be also stored in "%windir%\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 menu searchbox and press Enter:
%windir%\System32\drivers\etc\
2. Now you'll see a file with the name hosts in etc folder.

3. Open the file in Notepad and replace its content with following text:
For Windows 7:
# 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# 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 host127.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 host127.0.0.1 localhost
4. Save the file and you have reset the 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...
This article was posted by VG in following section: Troubleshooting, Windows 7, Windows Vista, Windows XP.
If you enjoyed this article, subscribe to our RSS feed or free newsletter to get all new articles directly in your Inbox. Also check out our popular articles and archive to read other interesting articles.
odio
we can loose something for reseting this? or we could do it periodicaly without troubles?
VG
^^ You'll not loose anything unless you modified the file yourself and added custom entries or used a 3rd party software to add entries.
nipunb
there's one more free utility named "HostsXpert", it can do a lot of functions related to Hosts file like edit, merge, replace, backup, restore the original windows hosts file even if the hosts file is deleted from the etc folder. Its really useful for dealing with hosts file......
Lester
Spelling Mistake on Line 1 Column 3 (quotes no counted) :
[quote] "Hosts" file ia an important system file in Windows which maps hostnames to IP addresses. [/quote]
The ia needs to be changed to is.
VG
^^ Thanks mate. Corrected. Guess What? I'll need to double-check articles before posting. ;)
Lester
^^ Haha. Anyway, Windows 7 theme packs can work on windows 8? Just curious...
Lester
Oops.. Found another mistake :
Look in this part :
For Windows 7:
# 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
# localhost name resolution is handle within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost
______________________________________________
The # should not be on the last 2 lines. Should be like this:
For Windows 7:
# 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
# localhost name resolution is handle within DNS itself.
127.0.0.1 localhost
::1 localhost
Regards,
Lester
VG
^^ No. Its correct.
Regarding themepacks, if you are talking about .themepack, yes they work.
Lester
TY VG
yethz
Optimize hosts file by removing un-needed text entries.
entries that have # from the first line...