hosts file tampered with


New Member

I've tampered with my hosts file when installing some software, which didn't end up working for me in the end. Are there any big issues with keeping my file in this state? It seems to be ok but I would like to return my hosts file to its original state, and all the tutorials online seem to bring me roadblocks.

The only thing I'm noticing different with my computer is that the search function isn't working, but that could be unrelated. Anyone have an idea what that might be?

So I'm just looking to get my hosts file back to normal, and hopefully get my search functioning again. Thanks


Excellent Member
Microsoft Community Contributor
Have you tried right clicking on the file and select "Restore Previous"?

Here is your hosts file. Seriously. Just copy and paste this into and then save this with notepad overwriting the one you have now at C:\Windows\System32\drivers\etc\hosts

Code:  localhost
You can add any entries to it you want in the future as long as you keep this as the top line.


New Member
That sounds easy enough, however do i need to disassociate the hosts file so i doesn't show up as a .txt file? or will the hosts file work fine as a .txt?

Right. You have to make sure it saves as hosts and not hosts.txt.

It probably will save as hosts.txt so you can navigate there in Explorer and rename it by removing the .txt.

You might have to set Explorer to show extensions. That's simple enough to do as well. Click Computer. Organize | Folder and Search Options | View tab

Take away the check boxes for
"Hide extensions for known file types" and also
"Hide protected operating system files" and
click the radio button for "Show hidden files, folder and drives"

Click ok after. Then go to rename. Delete the original hosts first if it is present.


Extraordinary Member
Have to agree TorrentG's method is simplest and easiest method to clean hosts file, also if you need a bit more web protection use Spybot S&D to add hostfile blocks for thousands of known malware IPs.


New Member

I've successfully followed your instructions and it seems to be fine. Originally I went to the windows site and used their auto fix tool to try and reset my hosts file. After using the tool i think it added a file "lmhosts". Could i delete this file as well? because when opened in notepad it reads "This is a sample hosts file....".

Thanks for your help torrentG and highwayman for the confirmation, I should have resorted to this thread ages ago.


Honorable Member
If it says lmhosts.sam, it's just a sample file and you can ignore it, it doesn't do anything. Active files have no extension. Their names are just HOSTS and LMHOSTS, usually in lower case. Anything that has a '#' at the begining of the line is not executable code, but just a note.

If you are just a home user and are not connected to a local network, you don't need to use it. If it says lmhosts, just add a ".sam" to it so you will be using the hosts instead.

Last edited:
This website is not affiliated, owned, or endorsed by Microsoft Corporation. It is a member of the Microsoft Partner Program.