Locahl
hosts fileWindows 1124H2PowerShelllocal development

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.

L

Locahl Team

·3 min read

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

TEXT
Path: C:\Windows\System32\drivers\etc\hosts

1. Press Windows key, type Notepad, right-click → Run as administrator. 2. File → OpenC:\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

FeatureImpact on hosts file
Smart App ControlMay block unsigned editors — use Notepad/Terminal as admin
Controlled Folder AccessCan block writes to protected folders — allow your editor in Windows Security
Windows Terminal defaultFaster path: notepad C:\Windows\System32\drivers\etc\hosts in admin Terminal

Fix Controlled Folder Access blocking saves

1. Windows SecurityVirus & threat protectionRansomware protection. 2. Controlled folder accessAllow an app through Controlled folder access. 3. Add Notepad or your preferred editor.

PowerShell one-liner (24H2)

POWERSHELL
Start-Process notepad "C:\Windows\System32\drivers\etc\hosts" -Verb RunAs

Flush DNS on Windows 11 24H2

Command Prompt / Terminal:

CMD
ipconfig /flushdns

PowerShell (24H2):

POWERSHELL
Clear-DnsClientCache

Verify:

CMD
ping mysite.test

24H2 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

BuildNotable difference
22H2 / 23H2Standard UAC + Notepad admin
24H2Smart App Control, stricter Controlled Folder Access defaults
Win 10Same 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.

Also readFull Windows 10 & 11 hosts guide
Share this article
Available on Windows, macOS & Linux

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
Buy Locahl, €4.99One-time payment, no subscription

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

4 min read
hosts fileadmin rightspermissions

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

L

Locahl Team

Developer tools team

4 min read
localhostsubdomainslocal development

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.

L

Locahl Team

Developer tools team

2 min read
hosts fileWindowseditors

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.

L

Locahl Team

Developer tools team

2 min read
hosts filednsmasqwildcard

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.

L

Locahl Team

Developer tools team