Windows 10 Can’t Save Hosts File: Editing a Protected System File the Right Way
You open the hosts file in Notepad to block a site or point a name to a local server, add your line, and select Save. Windows replies with “Access is denied,” or Notepad offers to save YYPAUS Login a copy somewhere else. When Windows 10 can’t save hosts file, a simple network change turns into a puzzle.
The hosts file tells Windows which address to use for a website name before it asks a DNS server. Because malware has long abused it to redirect browsing, Windows protects it closely.
To change it, Notepad must run with administrator rights, the file must not be read-only, and security software must allow the edit.
Following the correct steps usually lets you save on the first try.
Why This Happens
Saving fails for these reasons:
- Notepad was opened normally instead of as administrator.
- The hosts file is marked read-only.
- Microsoft Defender or other security software blocks the change.
- Notepad saved the file as hosts.txt instead of hosts.
The file lives at C:\Windows\System32\drivers\etc\hosts and has no file extension.
Start With These Basic Checks
Open Notepad correctly.
- Type Notepad in the search box.
- Right-click Notepad and choose Run as administrator.
- Select File > Open, browse to C:\Windows\System32\drivers\etc, and change the file type filter to All Files.
- Open hosts, add your line at the bottom, and select Save.
- Run ipconfig /flushdns in Command Prompt so the change takes effect.
If saving works now, administrator rights were the missing piece.
Going a Step Further
Check attributes and security software.
- Right-click the hosts file, choose Properties, and untick Read-only.
- Open Windows Security > Protection history to see whether the change was blocked.
- Check third-party security suites for “hosts file protection” and allow the change temporarily.
- If a hosts.txt file appears in the folder, delete it and save again with “All Files” selected.
- Restart the browser after saving.
Some browsers cache addresses, so a restart or clearing the browser’s host cache may be needed.
A Word of Caution
Add only entries you understand, and keep a copy of the original file. Unexpected entries pointing well-known sites to strange addresses are a sign of malware. Turn security protections back on after editing.
Final Thoughts
The hosts file can only be saved with administrator rights. Run Notepad as administrator, check the read-only attribute, and allow the change in security software.
Keep a backup copy of the original hosts file in your Documents folder before editing, so you can restore it quickly if something stops working.