- To edit the âHostsâ file on Windows 11, open Notepad as an administrator.
- Use the âCtrl + Oâ shortcut and open the Hosts file from the âC:WindowsSystem32Driversetcâ location.
- Add a new IP address and domain mapping â for example,
127.0.0.1 domain.com
. - If you canât edit the Hosts file, itâs because you need administrative permissions.
On Windows 11, you can edit the âHostsâ file to manually override the systemâs Domain Name System (DNS) settings for a specific internet domain (website) or device connected to the local network.
Usually, you donât have to worry about manually mapping an IP address to a domain name using the Hosts file located in the C:WindowsSystem32Driversetc
 path on Windows 11. However, it can come in handy in many scenarios. For instance, when you want to block certain websites. When you donât have a local DNS server in the network, you must map an IP address to a computer name or prepare a website transfer to a new hosting provider.
Regardless of your reason, Windows 11 makes it super simple to edit the Hosts file using Notepad or any other text editor application as long as you open the app as an administrator. Otherwise, you wonât be able to edit the file.
In this guide, you will learn the steps to modify the Hosts files on Windows 11 to map host names to IP addresses.
- How to edit Hosts file on Windows 11
- How to edit Hosts file from PowerToys on Windows 11
How to edit Hosts file on Windows 11
To edit the âHostsâ file on Windows 11, use these steps:
-
Open Start on Windows 11.
-
Search for Notepad, right-click the top result, and select the Run as administrator option.
-
Click on File and select the Open option.
-
Browse to the Hosts file location:Â
C:WindowsSystem32Driversetc
-
Use the drop-down menu next to âFile name,â and select the âAll Filesâ option.
-
Select the Hosts file.
-
Click the Open button.
-
In a new line, enter the IP address of the remote server, add at least one space, and confirm the domain name or computer name to reach the service. For example,
159.223.126.251 google.com #This PC redirects Google.com to the specified IP address
.Quick note: If you want to add another entry, use a new line and donât use the pound sign (#) since that symbol is only used for commenting.
-
(Optional) Type the following line to block a specific website (for example, Facebook):
127.0.0.1 facebook.com #This PC will block access to Facebook
-
Click on File.
-
Select the Save option.
Once you complete the steps, you can test the changes by opening Command Prompt and using the ping command to ensure the host is reachable.
If you want to block your computer from accessing certain websites, you can use the loopback address (127.0.0.1) followed by the domain name (127.0.0.1 website.com). Also, if you can edit the âHostsâ file on Windows 11, itâs because you need administrative permissions.
How to edit Hosts file from PowerToys on Windows 11
PowerToys 0.64 and higher releases include a new âHosts File Editorâ that makes it easier to add and remove entries from the Hosts files on Windows 11.
To edit the Hosts files with the PowerToys editor, use these steps:
-
Open PowerToys.
-
Click on Hosts File Editor.
-
Under the âActivationâ section, click the âLaunch Hosts File Editorâ option.
-
Click the Accept button for the warning.
-
Click the New entry button.
-
Confirm the IP address, hosts name, and comment (as necessary).
-
Turn on the Active button.
-
Click the Add button.
After you complete the steps, the Hosts file will save with the new entries, and you should now be able to test the new configuration. Also, in the editor, you can enable or disable entries with a single toggle switch.