This post shows students and new users how to edit or modify Windows 11 local host files.
When you think of a host file, think of it as a plain-text file used by the operating systems to map or connect IP addresses to hostnames on the local computer.
Most Windows systems have both a host file and a Domain Name System (DNS). If both the host file and DNS have the same records, the host file has priority over DNS.
While translating the resource names to IPs, the local host’s File is the first File your operating look at. If the IP to domain mapping isn’t included in the host file, it looks up a DNS server online. This is how the process works.
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
The host’s File must be opened as an administrator on Windows systems. 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 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 as an administrator in Notepad. 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 will be able to example.com in your browser as soon as you save the File.
Conclusion:
This post showed you how to edit Windows hosts files. If you find any error above, please use the comment form below to report.