How to Tutorials Other Topics

How to: Edit Hosts File in Windows 7


Update: Make sure to read the valuable comments on Hosts File Editing.

For some reason, I needed to modify Hosts file in Windows 7. I went trough the same procedure which we use in XP and Vista but it was not working. In XP and Vista we follow the same procedure to edit hosts file. It should always be in mind that hosts file’s attributes are always “Read Only”. We have to open the Properties window by right clicking on hosts file and have to uncheck the Read Only attribute. Then open it in Notepad or any text editor and can modify it. But this procedure did not work when I tried to do on Windows 7.

It was in my mind that in Windows 7, we will follow same procedure and should be but it was not. I did right click on hosts file and opened the Properties window. I noticed that “Read Only” attribute is already unchecked. OK! so thought that it is good that one step is removed by default settings. I opened it with Notepad and edit it and tried to save. When wanted to save, Windows did not let me save it. Then I wanted to to replace original with Save As but again could not do.

It is clear that if we could not save it in Notepad or by using any other text editor, then what is the solution? I tried one small trick. Simply opened the Notepad and through File menu, I opened Hosts file. Now you will think that it is same again opening in Notepad but this trick worked. OK! I opened Hosts file in Notepad through File menu and edited it and saved it. I was able to save the edits in Hosts file through this trick.

[Related Article: Edit Hosts File in Windows 8]

Does not it feels silly that the same tool is used for editing in different ways. No, not even the different ways. One way the tool did not work and the other way it worked. I tried to justify this foolishness behavior by Googling the reason but could not. BTW, in Windows 7, Hosts file can be found here:



Related posts

Notify of
Newest Most Voted
Inline Feedbacks
View all comments

Windows 7 uses local account policy for DNS settings and can be found by using gpedit.mscIt seems with the changes to internet standards moving away from IP4 we are now entering IP6 migrations and Windows 7 is full force for this change. I must admit from my experiances with all operating systems (Linux, Apple, and… Read more »


I was searching for a deeper understanding in regards to further development about networking in Windows 7 and stumbled across this post. When I think of HOST file for changes in regards to name resolution for networking I quickly think of the last 18 years with Microsoft in regards to local peer to peer networking.… Read more »


You need IP6 to set up a Windows 7 home network? Why add the extra burden? And for Buddha's Sake, if you're going to HIDE settings in Group Policy and not bother having anything in Control Panel -> Networking, you can expect a LOT of disgruntled users trying to migrate from XP (like me…)


I found out how to use the HOSTS file in Windows 7. Seeing as how I just assumed and jumped the gun in setting up the HOSTS file from, I didn't know what it originally looked like. So I found how to reset it. put in this new looking ::1 thing. Fine okay but… Read more »


man, thank you very much.. it seems that this is the only way that helped me out with this god damn hosts file thing.. again, thank you!


I am happy that the article is of your use.Regards,Perti


I found a solution. It took a while but it did work.Go to the properties of the hosts file and go to the security tab.Highlight your user name and click edit then check the box "Modify" this automatically includes "write" this way you will be able to edit the file much easier.

Would love your thoughts, please comment.x