Help! My Hosts File is Missing!

Written by:  • Edited by: Bill Bunter
Updated Aug 10, 2010
• Related Guides: Windows 7 | Hosts File

Looking for your hosts file and now you can't find it? Then this article is for you. Relax, all is not lost.

Introduction

If you are looking for your hosts file, either you are somewhat technical with computer networks and you use the hosts file and thus familiar with what it is, or you are a typical user and something in your system is telling you that it cannot find the hosts file. Hopefully it is the former, but most likely it is the latter, or it could be both.

In any case, the goal of this article is to help you recover.

Where is the hosts file?

First we need to make sure we are looking in the right spot. The operating system knows where to look because the registry tells it where the "hosts" file is stored:

HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\DataBasePath=

In general,

DataBasePath = %SystemRoot%System32\drivers\etc.

By default, this path is c:\windows\system32\drivers\etc. This is true for Windows 2000 all the way up to Windows 7.

Restoring the hosts file

Now that you know where the hosts file is or is supposed to be, you'll want to double check if it is there or if there is some form of back up there. If you find a file that looks like a backup of your hosts file, then copy that file to a file called "hosts". If you aren't sure, then don't. Note that the "hosts" file has no extension, so make sure this is the case. The hosts file backup (if any) is a basically text file (as is the original "hosts" file). It may be called hosts.bak or something similar. All you need to open and read it is the Windows Notepad program.

If you can't find the hosts file and a backup doesn't exist, then you'll have to create a new "hosts" file. To create one, you'll need to open the Windows Notepad program and enter the following information in it:

127.0.0.1 localhost

::1 localhost

The "1" in the "127.0.0.1" must be at the very first column of the line. Also, there must be at least one space between "127.0.0.1" and "localhost". The second line is an IPv6 address mapping to localhost, and this line is part of the default hosts file for Windows Vista and Windows 7. There must be at least a space between "::1" and "localhost".

In Windows 2000 or XP, all you need to do to save this file as "hosts" and you are done. In Windows Vista or 7, you must have started the notepad program "as Administrator". This will allow you to save to the "hosts" file and the path where you are trying to save is a system type file.

Once you've created the new hosts file, you are done and you've basically recovered. If you had some IP address-name mappings in the original hosts file for your computers in your home network, then you may append them to the hosts file; each mapping must have its own line.

IMPORTANT: The hosts file typically doesn't disappear on its own. There should be nothing touching that file, unless you explicitly decided to modify it or you have a computer security program that modifies it to prevent you from going to malicious web sites. Thus, you should do a full system virus/malware scan as your computer may be infected! Just do this as a precaution.

Summary

To quickly recover from your missing host file, you'll need to create a new one in c:\windows\system32\drivers\etc and put some default entries in it. This will get your computer to its baseline hosts file configuration. You may also append other IP address-name mappings you may have had in the original hosts file. As a precaution, it is recommended that you do a full virus/malware scan of your system as nothing should be touching your hosts file; the fact that your hosts file disappeared may be a symptom that your computer is infected.


Comments

Showing all 9 comments
 
J. Forlanda Jan 21, 2012 8:02 AM
RE: Help! My Hosts File is Missing!
What you need to do is RUN notepad as ADMINISTRATOR, then open the HOSTS file.  If you do it this way, you can save the file by simply doing a simple FILE-:>SAVE.
Imagewicked Jan 18, 2012 4:34 PM
RE: Help! My Hosts File is Missing!
whenever i try to save, it says that the hosts file already exists and if i wanted to overwrite it. i pressed yes and it told me it was read only and i had to try again with a different file name
J. Forlanda Nov 20, 2011 12:19 AM
RE: Help! My Hosts File is Missing!
When you open notepad, make sure to open it as Administrator.  This little video (http://youtu.be/bRnu3fH4DCU) shows you how to do it.  Note that there is no audio; it just shows you what you need to do in order to find and edit the hosts file.  Once you open and edit it, you can simply SAVE it.
J. Forlanda Nov 20, 2011 12:03 AM
RE: Help! My Hosts File is Missing!
This youtube video shows where the host file is located:  http://youtu.be/t0XxvcQfn0I
Whatz4me Nov 19, 2011 7:49 AM
RE: Help! My Hosts File is Missing!
It is where a 64 bit Windows 7 stores the file nothing wrong with it. You need to open Notepad with Run as admin then open the file from File -> Open and you will be able to save it.
bran Apr 15, 2011 8:17 PM
RE: Help! My Hosts File is Missing!
can you make a vid i don't know what hapd to my hosts file
Tanor Mar 27, 2011 10:51 AM
No hosts file on Windows XP
Hai. I'm commenting here that I can't find my hosts file. Because I'm looking for it since I have an Internet Redirect Virus. When I go to where there should be the hosts file. I only get lmhosts, protocol, networks, and services. I also went to folder options and checked it to show hidden files if the hosts file is hidden. But it wasn't there.

Is there another way to reach the file, possibly by Command Prompt?
indrew20@gmail.com Mar 17, 2011 1:34 PM
Host file keeps saving as a .txt file
On notepad when I go to save it i save it as an All Files but it keeps reverting back to a .txt help?


Thanks!
Koala Mar 10, 2011 10:17 PM
No hosts file windows 7 64bit
Hello,

Thanks for the information. I got here because I can't find my hosts file. Instead I found a hosts.ic and a hosts but saying something about home network.

I tried searching in whole windows path and I found a hosts normal looking file in "C:\Windows\winsxs\amd64_microsoft-windows-w..nfrastructure-other_31bf3856ad364e35_6.1.7600.16385_none_6079f415110c0210" that I can't modified (notepad with admin rights).

Do you know what's wrong and how it should be?

Thank you

P.d.: nothing seems to be wrong in my computer.
 
blog comments powered by Disqus
Email to a friend