This post shows students and new users how to edit or modify Windows 11 local host files.
You may need to edit the Windows 11 Hosts File for several reasons.
One common reason is to block or redirect certain websites or IP addresses. For example, you can use the Hosts File to block access to websites you consider harmful or inappropriate.
Another reason is to map hostnames to IP addresses for local testing or development purposes. This can be useful if you’re a web developer or network administrator who needs to test websites or network configurations on a local machine.
Overall, editing the Windows 11 Hosts File can be a powerful tool for managing network connections and controlling access to websites or online resources.
When dealing with a host file, the IP address and the domain or hostname should be separated by at least one space or tab. The lines starting with # are comments and are ignored.
When you’re ready to edit Windows 11 local host file, follow the steps below:
Windows 11 Hosts File
As mentioned above, the host file is a plain-text file used by the operating systems to map or connect IP addresses to hostnames on the local computer.
The Windows hosts file is located at the path below:
c:\Windows\System32\Drivers\etc\hosts
The content of the host file looks like the lines below. This is the default host file that comes with all Windows-based systems.
# Copyright (c) 1993-2009 Microsoft Corp. # # This is a sample HOSTS file used by Microsoft TCP/IP for Windows. # # This file contains the mappings of IP addresses to host names. Each # entry should be kept on an individual line. The IP address should # be placed in the first column followed by the corresponding host name. # The IP address and the host name should be separated by at least one # space. # # Additionally, comments (such as these) may be inserted on individual # lines or following the machine name denoted by a '#' symbol. # # For example: # # 102.54.94.97 rhino.acme.com # source server # 38.25.63.10 x.acme.com # x client host # localhost name resolution is handled within DNS itself. # 127.0.0.1 localhost # ::1 localhost
Changes you make to the host’s File take effect immediately. If you want to undo changes to the host’s File, simply open the File and remove the lines you added or precede the line with a # to ignore it.
Add Host Records
An administrator on Windows systems must open the host’s file. If the host’s File is not opened as an administrator, it won’t allow changes to be saved.
Since only the administrator can edit the host file, search for and open the Windows Command Prompt app as administrator, as shown in the image below.

When the Command Prompt opens, type in the commands below, then press Enter to open the host’s File in Notepad.
notepad.exe c:\Windows\System32\Drivers\etc\hosts
This will open the local host file in Notepad as an administrator. You can begin editing the host’s File.
For example, to add an entry to translate 127.0.0.1 to example.com, open the host’s File and add its entry by scrolling down to the end of the File and add your new entries:
# Copyright (c) 1993-2009 Microsoft Corp. # # This is a sample HOSTS file used by Microsoft TCP/IP for Windows. # For example: # # 102.54.94.97 rhino.acme.com # source server # 38.25.63.10 x.acme.com # x client host # localhost name resolution is handled within DNS itself. # 127.0.0.1 localhost # ::1 localhost 127.0.0.1 example.com ...
After copying the content, click File –> Save from the top menu, as shown below. Then, save and replace the existing File in the same location.

That should do it!
As we said above, the changes take effect immediately. You can use example.com in your browser when you save the File.
Conclusion:
- Editing the Windows 11 Hosts File is a straightforward process that can enhance your browsing experience by blocking unwanted websites or redirecting URLs.
- It serves as an essential tool for developers and network administrators for effective testing and configuration.
- Always ensure you run the editor with administrative privileges to save changes to the Hosts File.
- Remember that any modifications take effect immediately, making it easy to manage and adjust as needed.
- Regular reviews of the Hosts File can help you maintain an optimal network configuration and browsing environment.
Leave a Reply