Edit Hosts File on Windows 11 24H2 (2026)
Windows 11 24H2 hosts file guide: Smart App Control, Controlled Folder Access, Notepad admin, PowerShell, ipconfig /flushdns and Clear-DnsClientCache.
Locahl Team
Table of Contents
- Edit hosts file on Windows 11 24H2 — quick steps
- What's new in 24H2 that affects hosts editing
- Fix Controlled Folder Access blocking saves
- PowerShell one-liner (24H2)
- Flush DNS on Windows 11 24H2
- 24H2 troubleshooting
- Access denied when saving
- Changes ignored after reboot
- Local HTTPS after hosts change
- Windows 11 24H2 vs earlier builds
- Group Policy note (enterprise)
- Conclusion
Windows 11 24H2 keeps the same hosts file path as earlier builds, but adds security features that occasionally block saves to System32. This guide covers 24H2-specific fixes.
For the general Win 10 & 11 walkthrough, see edit hosts on Windows 10 & 11.
Edit hosts file on Windows 11 24H2 — quick steps
Path: C:\Windows\System32\drivers\etc\hosts1. Press Windows key, type Notepad, right-click → Run as administrator. 2. File → Open → C:\Windows\System32\drivers\etc → filter **All Files (*.*) → open hosts. 3. Add: `127.0.0.1 mysite.test` 4. Ctrl+S to save. 5. Open Terminal as administrator** → ipconfig /flushdns
What's new in 24H2 that affects hosts editing
| Feature | Impact on hosts file |
|---|---|
| Smart App Control | May block unsigned editors — use Notepad/Terminal as admin |
| Controlled Folder Access | Can block writes to protected folders — allow your editor in Windows Security |
| Windows Terminal default | Faster path: notepad C:\Windows\System32\drivers\etc\hosts in admin Terminal |
Fix Controlled Folder Access blocking saves
1. Windows Security → Virus & threat protection → Ransomware protection. 2. Controlled folder access → Allow an app through Controlled folder access. 3. Add Notepad or your preferred editor.
PowerShell one-liner (24H2)
Start-Process notepad "C:\Windows\System32\drivers\etc\hosts" -Verb RunAsFlush DNS on Windows 11 24H2
Command Prompt / Terminal:
ipconfig /flushdnsPowerShell (24H2):
Clear-DnsClientCacheVerify:
ping mysite.test24H2 troubleshooting
Access denied when saving
- Close Notepad, reopen as administrator (not just elevated from a non-admin session).
- Check Controlled Folder Access (above).
- Temporarily disable third-party antivirus if it restores the hosts file.
Changes ignored after reboot
Some security suites reset hosts on restart. Whitelist the file or use a dedicated hosts manager.
Local HTTPS after hosts change
If you use .test domains with mkcert, pair hosts edits with local HTTPS setup and flush DNS after every change.
Windows 11 24H2 vs earlier builds
| Build | Notable difference |
|---|---|
| 22H2 / 23H2 | Standard UAC + Notepad admin |
| 24H2 | Smart App Control, stricter Controlled Folder Access defaults |
| Win 10 | Same path, no Smart App Control |
Group Policy note (enterprise)
On domain-joined PCs, Group Policy may lock hosts or redirect DNS. If saves succeed but changes never apply, ask IT whether a GPO overrides local hosts.
Conclusion
Windows 11 24H2 does not move the hosts file — it adds security layers. Run Notepad as admin, allow the editor through Controlled Folder Access if needed, and flush DNS with ipconfig /flushdns or Clear-DnsClientCache.
Ready to simplify your workflow?
Stop wasting time with the terminal. Locahl lets you manage your hosts file in a few clicks, with automatic validation and no risk of errors.
- Intuitive visual interface
- Automatic DNS flush
- Multi-environment management
- Automatic backups
- JSON Import/Export
Frequently Asked Questions
Does Windows 11 24H2 change the hosts file location?
No. Still C:\Windows\System32\drivers\etc\hosts — same as Windows 10 and earlier Windows 11 builds.
Why does Smart App Control block my hosts editor on 24H2?
Smart App Control may restrict unsigned third-party editors. Use Notepad or Windows Terminal run as administrator — both are trusted.
How do I flush DNS on Windows 11 24H2?
Open Terminal as admin: ipconfig /flushdns. In PowerShell you can also run Clear-DnsClientCache.
Related Articles
Can You Edit the Hosts File Without Admin Rights?
Can you edit the hosts file without administrator rights? The honest answer plus real alternatives on Windows, Mac and Linux when you cannot elevate (proxy, Docker, local DNS, SSH).
Locahl Team
Developer tools team
How to Use Subdomains on localhost for Local Development
Use subdomains on localhost: the free *.localhost trick browsers resolve automatically, fixed subdomains via the hosts file, and wildcard subdomains with dnsmasq on Mac and Linux.
Locahl Team
Developer tools team
Best Hosts File Editors for Windows (2026)
The best hosts file editors for Windows in 2026: Locahl, Notepad as admin, Hosts File Editor+, SwitchHosts and BlueLife Hosts Editor. Pros, cons and when to use each.
Locahl Team
Developer tools team
Which TLD to Use for Local Development (.test vs .localhost)
Which TLD to use for local development: prefer .test, avoid .dev and .local. Why .test is reserved, how to map it in the hosts file, and HTTPS tips.
Locahl Team
Developer tools team
Wildcard Local Domains: hosts File Limits & dnsmasq
The hosts file does not support wildcards like *.myapp.test. Learn why, and how to set up wildcard local domains with dnsmasq on macOS and Linux.
Locahl Team
Developer tools team