≡ Menu

How to edit host file in XP/Vista/Windows 7?

It's only fair to share...Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInPin on PinterestShare on VKShare on RedditPrint this pageEmail this to someone

Host file is a file inside windows operating system which is used for mapping host names to ipaddress. Editing host file is done rarely, unless you have an issue with the host file. Malware programs often attack host file to make the web browsers redirect to malicious websites or ipaddress. In such cases, it becomes important to edit host file to get rid of these suspicious entries. In this tutorial, you will learn how to make changes or edit host file.

Location of Host file

The host file is located in the same folder in WinXP, Vista and Win7 . You can directly open the file from the location C:\Windows\System32\Drivers\Etc.

You can also open the location by entering the location in “Run” window

Click Start -> Run -> type %systemroot%\system32\drivers\etc\

host file run window

How to open and make changes in Host file

Right click on host file -> Open -> Select Notepad ->Click OK.
This will open host file using a notepad. You can now start making changes.

edit host file

How to save the changes made on Host file?

If you are logged in as an administrator user in WinXP, there are no additional steps. Just open the host file using notepad, save the changes normally as you usually do in notepad.

Vista and Win7 won’t allow making changes to host file because of the additional security provided to these files. Even if you are logged in as an administrator user, you still need to open the file with admin rights to make the changes.

  • Right click on Host file
  • Click Open
  • Select “Run as Administrator

Now you should be able to save the changes made on the file.

If you try to make changes without administrator rights, you might end up with a message as shown  below.

host file error

It's only fair to share...Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInPin on PinterestShare on VKShare on RedditPrint this pageEmail this to someone

About the author: Anup Raman A Tech Enthusiast|Blogger|Tech Trainer with 10+ yrs experience in the field of IT. My expertise are in Operating Systems, mainly Windows and Computer security which comes from my experience, working as Tech Support and Trainer for Microsoft, Symantec and McAfee. Loves blogging about Technical Troubleshooting, discussing latest Gadgets, Games and doing Reviews.

{ 5 comments… add one }
  • FelixINX Jun 14, 2014, 8:09 pm

    You can save the hosts files by open the notepad as admin. The open the hosts file save in your documents. After, save as to the etc directory. Remember to choose all files, not txt.

  • Esteban Dec 22, 2013, 9:39 am

    When I open Host file I can’t find anything to run as administrator.

    • Anup Raman Dec 22, 2013, 10:06 am

      Some computers may not have host file. There are chances the file got deleted while removing temporary files by system optimization software. It is not an essential file. It’s okay if you don’t have the file.

  • Michael Ferber Nov 29, 2012, 12:59 am

    When I click on etc there is no Hosts file, the othere 4 are there but not that one??? I’ve searched for it numerous times and can’t find it to edit the file. Any suggestions? Thank you for your help the video is very informative and I think it will fix the problem if I could find the file.

    • Anup Raman Nov 29, 2012, 5:07 pm

      First of all, nothing to worry about not having hosts file inside computer. There are scenarios when hosts file gets deleted from computer, most of the times accidentally.It’s okay not to have the host file in computer.

      There are certain softwares which may require you to make changes in host file as part of its configuration.In those cases,you can get a healthy host file from another computer and put it inside the drivers location.

Leave a Comment

Show Buttons
Hide Buttons