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, then it looks up a DNS server online. This is how the process works. When you’re 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 we 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: The content of the host file looks like the lines below. This is the default host file that comes with all Windows-based systems. 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

On Windows systems, the host’s file must be opened as an administrator. 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. 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: 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.