Editing Windows Hosts File (Windows XP,Windows 7, Windows 8)

0 Flares 0 Flares ×

Windows hosts file is the file used by your Windows system to map host names to IP addresses. This is a plane text file and known as hosts file in all systems including MAC and Linux. If you need to edit your hosts file then you have come to the right place. But before proceeding to the editing part lets first know something about the windows hosts file.

Some Facts About Windows Hosts File

As I have already mentioned windows hosts file is the file used by your windows operating system to map host names to IP addresses. The entries in the host file looks as below:

# [Local Hosts]
127.0.0.1 localhost
127.0.0.2 example.com
127.0.0.3 example1.com
127.0.0.4 example2.com
127.0.0.5 example3.com
127.0.0.6 example4.com

The above example just contains some dummy data but the format is the same used everywhere. This host file is loaded into memory when you start your windows system. So whenever you look for any host or domain Windows checks this file first before it queries the DNS server. So for example you type localhost in your web browser the your system gets the mapped IP 127.0.0.1 from this host file and points to this IP.Note that this file does not have a file extension. Now lets see where to look for this file and how can you edit it under various Windows systems.

Editing Windows Hosts File

Lets first see how to edit host file under Windows XP system.

Location of Windows Hosts File:
System Location
Windows 95/98/ME %WinDir%\\hosts
Windows NT/2000/2003/XP Pro %SystemRoot%\\system32\\drivers\\etc\\hosts
Windows XP Home %SystemRoot%\\system32\\drivers\\etc\\hosts
Windows Vista %SystemRoot%\\system32\\drivers\\etc\\hosts
Windows 7 %SystemRoot%\\system32\\drivers\\etc\\hosts
Windows 8 %SystemRoot%\\system32\\drivers\\etc\\hosts

 

 

 

 

 

 

 

Where %SystemRoot% is the directory where Windows is installed. Generally it is c:\windows unless you installed in a different partition. %WinDir% is the directory where your Windows95/98/ME is installed, generally it is: c:\windows

Editing the Windows Hosts File

Its not difficult to edit the hosts file just open it in a text editor (Notepad) edit it and save it. Note that you must have admin access to edit this file.

Editing Hosts file Under Windows 7/Windows 8 system

It is bit tricky to edit hosts file under Windows 7/8. So lets see how do you edit it.

Step1: First of all navigate to the host file directory (%SystemRoot%\\system32\\drivers\\etc\\)

Step2: The files under this directory are hidden by default, so make sure that you disable hiding of files from the folder option menu. (Detail Process is Here: Show Hidden Files)

Step3: Go to run command and open Notepad as administrator (By right clicking and selecting Run as administrator)

Step4: Now as you can see the files under etc folder, you can also see the ‘hosts’ file, just right click on it and open with notepad and edit and save it.

Guru

+Ayodhyanath Guru holds a B.Tech degree in Electrical Engineering and has worked with various prestigious clients in the IT industry and presently working as a Software Engineer. He is a part time blogger and presently authors the Jafaloo.Com blog. Being a tech enthusiast Guru likes to surf the web and blogs about interesting technical topics like How-To guides, freewares, Tutorials, Software, Gadgets, web applications etc. Apart from blogging he likes coding in Java/J2EE and PHP.

You may also like...

3 Responses

  1. Adrian says:

    Hi, thanks for the above sharing. I have been trying to save the hosts.txt but Window just kept prompting me this message, but I login as my window administrator. I made changes to the administrator rights as Full control, the problem persists. Can you advise me on this.

    Adrian

  2. wtflol says:

    windows 8 requires you to run notepad as administrator. fkin stupid.

0 Flares Twitter 0 Facebook 0 Google+ 0 LinkedIn 0 0 Flares ×