October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
Redmond desk4 min

10 Ways to Fix the Hosts File Not Working in Windows 11

Check the real hosts-file path, filename, syntax, and elevated save workflow in Windows 11. If a valid mapping still fails, troubleshoot DNS and network issues separately.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

If a hosts-file entry is not taking effect in Windows 11, first verify that you edited the real file at %WinDir%System32DriversEtc, saved it as hosts with no extension, and wrote the mapping in the right format. If the entry is correct but lookups still fail, investigate DNS or the network separately: the hosts file cannot repair an unreachable DNS server or blocked DNS traffic.

Start with the hosts file itself

Windows normally looks for the file at %WinDir%System32DriversEtc, usually C:WindowsSystem32driversetc. Microsoft’s hosts-file reset instructions describe the location and format for Windows 11 and Windows 10.

As an Amazon Associate I earn from qualifying purchases.

1. Confirm the path

Open File Explorer and enter %WinDir%System32DriversEtc in the address bar. Check that the file you edited is in that system directory, not a copy in Documents, Downloads, or another folder. The variable form follows the Windows directory; on a typical installation it resolves to the path above.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

2. Make sure the file is named hosts, not hosts.txt

A text editor may append .txt when saving a new file. In Notepad’s Save As dialog, choose All files for the file type and enter "hosts" as the filename. The quotation marks help prevent Notepad from adding a text extension. Confirm that the resulting file in the system directory is named hosts and has no extension.

#1 Best Overall
Sale
Microsoft Windows 11 (USB)
  • Less chaos, more calm. The refreshed design of Windows 11 enables you to do what you want effortlessly.
  • Biometric logins. Encrypted authentication. And, of course, advanced antivirus defenses. Everything you need, plus more, to protect you against the latest cyberthreats.
  • Make the most of your screen space with snap layouts, desktops, and seamless redocking.
  • Widgets makes staying up-to-date with the content you love and the news you care about, simple.
  • Stay in touch with friends and family with Microsoft Teams, which can be seamlessly integrated into your taskbar. (1)

3. Edit the system copy with administrator rights

The system directory is protected, so an ordinary editor session may not be able to save changes there. Microsoft’s documented workaround for access denied is to start Notepad as administrator, then open the file from that elevated window and save it. See Microsoft’s instructions for modifying the Hosts or Lmhosts file.

  1. Open Start, search for Notepad, and choose Run as administrator.
  2. In Notepad, choose File > Open, browse to %WinDir%System32DriversEtc, and change the file-type filter to show all files.
  3. Open hosts, make the change, and save. Approve the administrator prompt if Windows displays one.

Check that the entry is valid and active

4. Put the IP address before the hostname

Each active entry needs an IP address first, followed by one or more hostnames, with spaces or tabs between them. For example, a syntactically valid line has the form 203.0.113.10 example.test; use the actual address and hostname you intend to map, not this documentation example. Microsoft summarizes the format as an IP address followed by one or more hostnames, separated by whitespace.

5. Remove a comment marker only if the mapping should be active

A line beginning with # is a comment, so Windows does not use it as a mapping. If the intended entry starts with #, remove that marker and save. Blank lines are ignored and do not need to be deleted.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

6. Look for another active entry for the same hostname

Review the file for repeated entries matching the hostname you are testing. An old mapping can make the result confusing, and Microsoft’s PowerToys Hosts File Editor documentation notes that conflicting entries can affect precedence. Remove or correct stale mappings rather than assuming a universal rule for which duplicate entry wins.

Verify the lookup path before changing DNS settings

7. Check whether Windows is using the hosts mapping

The Windows DNS client checks its cache first, then the hosts file, and then a DNS server. When the queried hostname has a hosts entry, the client does not query the DNS server for that name. This is why an entry can affect a lookup even when the upstream DNS server has a different answer.

Test the exact hostname your application needs and compare it with the address in the active entry. Do not use nslookup as proof that the hosts file is being ignored: Microsoft documents that nslookup contacts a DNS server in a multi-server scenario, whereas the Windows DNS client follows its own resolution path. Also, do not assume every browser, VPN, proxy, or application resolves names identically.

8. Separate a hosts-file problem from a DNS or network problem

If names without hosts entries also fail, investigate DNS configuration and network connectivity rather than changing hosts-file permissions. Microsoft identifies an incorrect or unreachable configured DNS server as a cause of DNS client timeouts. Check with your network administrator or connection provider before replacing DNS settings, especially on a managed network.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

9. Check DNS filtering only when the symptoms point to it

DNS queries may also fail if a firewall or third-party security product blocks outbound DNS traffic on UDP or TCP port 53. That is a DNS/network path issue, not evidence that the hosts file needs broader permissions. Review relevant firewall or security-product rules only when ordinary DNS lookups are failing too, and avoid disabling protection as a blanket test.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Replace a damaged file or choose another editor

10. Restore Microsoft’s default sample if the file is corrupted or untrusted

If the file has malformed content or unwanted mappings you cannot confidently untangle, preserve it before replacing it. Microsoft’s reset procedure creates a clean default hosts file and retains the previous one as Hosts.old. Follow the Windows 11 steps in Microsoft’s reset guide: save the replacement as hosts using All files, keep the old file as Hosts.old, move the new file into the system directory, and approve the administrator prompt if requested. Add only the mappings you need afterward.

Consider PowerToys for repeated edits

For a one-time change, elevated Notepad is built into Windows and avoids installing another utility. If you maintain several entries, Microsoft PowerToys includes a Hosts File Editor with a graphical entry list and filtering; it runs as administrator by default and backs up the hosts file. Its documented default backup behavior deletes backups after 15 days while retaining the five most recent, and those settings can be changed. PowerToys can make edits easier to manage, but it will not fix an unreachable DNS server or blocked DNS traffic.

Microsoft describes temporarily mapping a hostname to a new server during a website migration as a Hosts File Editor use case; its 24–48-hour period is an example, not a universal DNS propagation guarantee.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Quick Recap

SaleBestseller No. 1
Microsoft Windows 11 (USB)
Microsoft Windows 11 (USB)
Make the most of your screen space with snap layouts, desktops, and seamless redocking.; FPP is boxed product that ships with USB for installation
$124.97
Bestseller No. 2

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.