The Perti

Perti Tells

Data &Tools

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:


  • 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 Microsoft)Microsoft made sure to listen to users in regards to Windows 7. Previous Vista owners will be proud to run Windows 7, yet administrators will find a ton of curve balls have been tossed at them when it comes to admistering this new operating system. Best tip I can give is make sure you understand group policy and active directory!Brandy lee

  • 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. The internet has evolved and so has the demand for operating systems. When you plan to make simple edit in HOST file plase redirect your attention to DNS as Windows 7 utilizes local policy or Group Policy if joined to domain. My advice is to open gpedit.msc and look at all the nice settings Microsoft gives you in regards to DNS under computer Configuration>Administrative Templates>Network>DNS ClientMicrosoft had to change loopback to help accommodate the need for change to IP version 6. With Windows 7 allot has changed in regards to how administrators manage their systems.Brandy Lee

  • 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 I couldn't modify the file as I didn't have rights.1) Open the properties of the HOSTS file at C:windowssystem32driversetc2) Click the Security tab3) You're probably under the User account and not admin. If admin, I guess you can follow this the same way.4) Edit that account5) Click on the account to edit and allow at least to write (I set to write and modify).Open it up and paste in what you want. Make sure to have127.0.0.1::1at the top.6) Run services.msc7) restart the DNS serviceFor me, all those stupid ads are now blocked. Hope this helps.

  • 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.

  • Pingback: How-to Block Unwanted Website In Chrome, Firefox, Internet Explorer, Opera Using Hosts File In Windows 8, 7, Vista & XP |

You Might Also Like