iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more
If you see “Access Denied” when editing the hosts file as admin, first make sure the text editor itself is running with administrator permissions. Then open the existing file from inside that elevated editor and save your change. Being signed in to an administrator account does not automatically elevate every app.
Why Windows denies the save
The hosts file is a plain-text system file Windows uses to map hostnames to IP addresses. Its usual location is %WinDir%System32DriversEtc, commonly C:WindowsSystem32driversetc. Because it is in a protected system folder, an ordinary editor session may be able to view the file but not save changes.
| # | Preview | Product | Price | |
|---|---|---|---|---|
| 1 |
|
Password Reset Disk for Windows 7, 8.1, 10, 11, Windows Password Recovery USB, Password Reset Tool | $21.90 | Buy on Amazon |
| 2 |
|
Lexar A30E USB 3.2 Gen 1 Flash Drive 128GB 2-Pack | $39.99 | Buy on Amazon |
Microsoft’s access-denied guidance recommends starting Notepad as administrator. That article covers specified Windows Server editions; it supports the elevated-editor step, but it does not identify the cause of every save failure on Windows 10 or Windows 11.
Open and edit the existing hosts file in elevated Notepad
-
Open Start, search for Notepad, right-click it, and select Run as administrator. Approve the Windows elevation prompt if one appears.
#1 Best Overall
Password Reset Disk for Windows 7, 8.1, 10, 11, Windows Password Recovery USB, Password Reset Tool- FOR FULL INSTRUCTION PLEASE READ DESCRIPTION
- Step 1: Boot from the USB Flash Drive - Insert the USB flash drive into an available USB port on your computer. - Turn on your computer or restart it if it’s already on. - As the computer starts, press the key that opens the boot menu. This key varies by manufacturer and model, but it’s often F2, F10, Esc, or Delete. - In the BIOS/UEFI setup menu, locate the Boot Options or Boot Order section. - Use the arrow keys to select your USB drive and move it to the top of the boot priority list. - Save your changes and exit the BIOS/UEFI setup. Your computer will now boot from the USB flash drive.
- After that its will take few minutes to reset Windows login password
- Package includes instruction how to use "Password reset USB" software
-
In the elevated Notepad window, select File > Open. Navigate to
%WinDir%System32DriversEtc. If the file list does not show the file, change the file-type filter to All files (*.*). -
Open the file named
hosts, nothosts.txt. The hosts file must have no file extension. -
Make only the intended change. Each entry puts an IP address first, followed by one or more hostnames separated by spaces or tabs. Lines beginning with
#are comments.Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Scan for outdated or missing drivers - takes under a minute3Clear out junk files and repair common Windows errorsSpecial offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy. -
Select File > Save in the same elevated Notepad window.
If saving is still denied
-
Confirm the editor is elevated. Close the editor and launch it again with Run as administrator; opening the file in a non-elevated window can still leave you unable to save.
-
Check which file you opened. Verify the location is the system
driversetcfolder and the filename ishostswith no extension. A newly createdhosts.txtis not the existing hosts file.Rank #2
Lexar A30E USB 3.2 Gen 1 Flash Drive 128GB 2-Pack- Lightweight and convenient: Lexar JumpDrive A30E (USB Type-A) boasts a slim, portable design for easy device compatibility; lightweight at 7.41 g
- Transfer speeds up to 100 MB/s: 10x faster than standard USB 2.0 drives; Based on internal testing, performance may vary depending upon the host device, interface, and usage conditions
- Wide compatibility: Compatible with tablets, laptops, Macs, and traditional Type-A devices, no software installation required; Reliably stores photos, videos & files
- Compact: Features a push-button retractor and a lanyard loop for on-the-go use
- Enhanced security: Lexar DataShield protects files, easily creates a password-protected safe with auto-encryption; Files deleted from the safe are securely erased and can't be recovered
-
Consider device-specific restrictions. If the correct file is open in elevated Notepad and saving still fails, the error alone does not establish the cause. Permissions may have been changed, or a work or school device may be governed by policy. Contact the device administrator rather than changing ownership or broadly weakening file permissions.
Recommended Free Tools
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Alternative: use Microsoft PowerToys Hosts File Editor
PowerToys includes a Hosts File Editor. Microsoft documents that it can be read-only when disabled and may display “Failed to save hosts file” when a change is made without administrator permissions. It is another interface, not a way around the permission requirement.
| Approach | When it may suit you | Permission requirement |
|---|---|---|
| Elevated Notepad | You want a familiar text editor and do not need a separate utility. | Notepad must be started with administrator permissions before opening and saving the file. |
| PowerToys Hosts File Editor | You already use PowerToys and prefer its dedicated hosts-file interface. | Administrator permissions are still needed to save changes; the editor can be read-only when disabled. |
Restore the Windows default hosts file instead of editing it
Use Microsoft’s Windows 10 and Windows 11 reset procedure only if you want the default contents, not merely to resolve a save error. Keep a backup of the current file so you can recover any custom entries.
-
Prepare a replacement hosts file with the desired default contents and save it as
hostswith no extension. If creating it in Notepad, choose All files (*.*) in the Save as type field. -
In the
driversetcfolder, rename the existing fileHosts.old.Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy. -
Copy or move the replacement file into
driversetc. Accept the administrator prompt if Windows displays one.Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

