Skip to content
Follow
Windows

How to Edit Hosts File with PowerToys on Windows 11

Richard
Written by
Richard
Updated 6 min read
How to Reset Your Microsoft Account Password
How to Reset Your Microsoft Account Password
Before you start
  • 14 steps
  • Needs administrator rights

The Microsoft PowerToys Hosts File Editor is a visual tool that lets you manage your Windows 11 hosts file without editing raw text. It is available in PowerToys version 0.65 and newer. The software maps website names to specific internet addresses.

Advertisement

The hosts file acts as a local phone book for your PC. Windows looks there first and points domain names to IP addresses before it checks external DNS servers. You can use this editor to test websites on your own network or to block unwanted domains quickly.

The editor gives you a table with a row for each entry, so you don’t have to open Notepad or worry about breaking the file’s format. It works on all Windows 11 editions, Home included. PowerToys itself is free.

⚡ Quick Answer

Open PowerToys, select Hosts File Editor in the left-hand list, switch on Enable Hosts File Editor and Launch as administrator, then click Launch Host File Editor. You can then add entries to the hosts file in a table, with no raw text editing, provided you have PowerToys 0.65 or newer.

Advertisement

Why use the Hosts File Editor?

The hosts file acts like a private phonebook. It links website names like “example.com” to specific internet addresses like “127.0.0.1”.

It is a plain text file that has been part of Windows for a very long time. Each line holds one IP address followed by one or more names. Windows reads the file whenever it needs to turn a name into an address.

Advertisement

Two common uses are:

  • Blocking a sitepoint the domain at 127.0.0.1, which is your own PC. The site then fails to load.
  • Testing a sitepoint a domain at a new server’s IP address before the public DNS records change. You see the new server while everyone else still sees the old one.

What happens when you finish?

Once you save an entry, your computer immediately updates its network behavior. Your browser will then use your custom mapping instead of asking the public DNS. This means you can redirect traffic instantly without waiting for global DNS propagation.

The change only affects this PC. Other devices on your network are not touched. It also applies to every program on the machine that uses Windows name resolution, not just one browser.

If a site still opens the old way after you save, the browser may be holding a cached answer. Close the browser completely and open it again. Some browsers also have a secure DNS setting that can skip the hosts file, so check that if the problem continues.

Advertisement

How to Install PowerToys

To get started, download the installer from the official Microsoft PowerToys website. Run the installer and follow the on-screen prompts. Once finished, you will have a suite of tools to manage your Windows system more effectively.

Check that you have version 0.65 or newer. Older builds do not include the Hosts File Editor. If you already have PowerToys, open it and look for an update notice on the General page. Installing the latest release over the old one keeps your settings.

How to Use the Hosts File Editor

You can edit the hosts file with PowerToys to block websites or redirect web traffic without messing with text files. Open Microsoft PowerToys and go to the Hosts File Editor tool. Make sure you run the app as an administrator so Windows lets you save your changes.

The steps below cover the whole job. Each one is explained in the sections that follow.

Advertisement
  1. Open PowerToys and select Hosts File Editor in the left-hand list.
  2. Turn on the tool and the administrator option.
  3. Launch the editor and add your entry.
  4. Save it, and test the result.
PowerToys Hosts File Editor
PowerToys Hosts File Editor

You must turn on "Launch as administrator" in the settings for PowerToys. This action is crucial because the hosts file is a protected Windows system file. Without administrator rights, you cannot save any changes you make to the hosts file.

  1. Open PowerToys from the Start menu or the system tray . The settings window opens.
  2. Click Hosts File Editor in the left-hand list.
  3. Switch on the Enable Hosts File Editor toggle if it is off.
  4. Switch on Launch as administrator. Windows may show a User Account Control prompt the next time you open the editor. Click Yes.

If the option is greyed out, the tool is probably not enabled yet. Turn on the main toggle first. You need an administrator account on this PC to approve the prompt.

Advertisement
Enabling the Hosts File Editor tool within Microsoft PowerToys settings
Enabling the Hosts File Editor tool within Microsoft PowerToys settings

After enabling, click Launch Host File Editor. To add a new entry, click the New entry button.

  1. On the Hosts File Editor page in PowerToys, click Launch Host File Editor. The editor opens in its own window and lists the entries already in your file.
  2. Click the New entry button. A panel opens with empty fields for the address and the host names.

If the editor shows a read-only message or a warning about permissions, close it and check that Launch as administrator is on.

Selecting Launch as administrator for the PowerToys Hosts File Editor
Selecting Launch as administrator for the PowerToys Hosts File Editor

Enter the IP address, such as 127.0.0.1 (the loopback address), and the domain name you wish to map. Click Add to save your changes.

Advertisement
  1. Type the IP address in the address field. Use 127.0.0.1 to block a site, or the server’s real IP address to redirect it.
  2. Type the domain name in the host field, for example example.com. If you also want to cover www.example.com, add that name as well, because each name is matched separately.
  3. Add a short note in the comment field if you like. It helps you remember later why the entry exists.
  4. Click Add. The new entry appears in the list and is saved to the hosts file.

Each entry has an on/off toggle. Switch it off to disable the mapping without deleting it. That is useful for a temporary test.

Interface for adding a new entry in PowerToys Hosts File Editor
Interface for adding a new entry in PowerToys Hosts File Editor
💡Pro TipAlways back up your original file before making changes.

You can copy the file from 📁C:\Windows\System32\drivers\etc\hosts to a safe folder on your desktop as a precaution.

The file has no extension, so it may look odd in File Explorer. Copy it and paste it into your chosen folder. Windows may ask for administrator permission to read or copy it. To restore it, copy your backup over the original and approve the prompt.

Advertisement
Entering IP address and hostname details in PowerToys Hosts File Editor
Entering IP address and hostname details in PowerToys Hosts File Editor

Troubleshooting and Permissions

If you cannot save changes, ensure you have enabled the Launch as administrator setting. If the file is locked by another program, close your browser and try again. If you make a mistake, you can delete the entry in the PowerToys interface to undo the changes.

  • Save failsturn on Launch as administrator, close the editor, and open it again.
  • File lockedanother program, often a browser or security tool, may be holding the file. Close it and try again. Some security software also protects the hosts file and will block changes until you allow them in its settings.
  • Change has no effectrestart your browser, and check that the entry is switched on and the domain is spelled correctly.
  • Undo a mistakedelete the entry in the editor, or restore the backup you made earlier.

Summary

The PowerToys Hosts File Editor simplifies the process of managing domain mappings. By using this tool, you avoid risky manual edits to system files. It is the safest way to handle local development environments, block domains, or redirect traffic on your Windows 11 machine.

⚠️WarningKeep a backup of the original file, turn on Launch as administrator, and remove entries you no longer need so old test mappings don't cause confusing problems later.

Have a question about this guide?

Answered by AI from this guide. Good questions may be added to this page — please don't include personal details.

Tags: #Windows 11

Did this guide fix your problem?

Richard

About the Author

Richard

Tech Writer, IT Professional

Richard is a writer at Geek Rewind who turns complex IT tasks into clear, step-by-step guides. He draws on years of hands-on experience in system administration and enterprise IT operations, focusing on Windows, Linux and WordPress: the problems people actually run into, and the fixes that work. His server and WordPress guides come from systems he runs himself. Richard builds and maintains the platform behind Geek Rewind, from its Ubuntu servers and Nginx configuration to its custom WordPress plugins. Many new tutorials start with readers' questions, and he's always glad to answer them in the comments.

Advertisement

No comments yet — be the first to share your thoughts!

Leave a Comment

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