This post shows students and new users how to edit or modify Windows 11 local hosts file.
When you think of a hosts file, think of it as 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 hosts file and Domain Name System (DNS). If both the hosts file and DNS have the same records, hosts file has priority over DNS.
While translating the resource names to IPs, the local hosts 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 hosts 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.
If you’re a student or new user looking for a computer to start learning on, the easiest place to start is Windows 11. Windows 11 is a major release of the Windows NT operating system developed by Microsoft. Windows 11 is the successor to Windows 10 and it’s expected to be released later this year.
When you’re ready to edit Windows 11 local host file, follow the steps below:
Windows 11 Hosts File
As we mentioned above, the hosts file is a plain-text file used by the operating systems to map or connect IP addresses to hostnames on the local computer.
Windows hosts file is located at the path below:
The content of the hosts file looks like the lines below. This is the default hosts 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: # # 18.104.22.168 rhino.acme.com # source server # 22.214.171.124 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 hosts file take effect immediately. If you want to undo changes to the hosts 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 hosts file must be opened as an administrator. If the hosts file is not opened as an administrator, it won’t allow changes to be saved.
Since only 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 hosts file in Notepad.
This will open the local host file as administrator in Notepad. You can begin editing the hosts file.
For example, to add an entry to translate 127.0.0.1 to example.com, open the hosts 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: # # 126.96.36.199 rhino.acme.com # source server # 188.8.131.52 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 save location.
That should do it!
As we said above, the changes takes effect immediately. You will be able to example.com in your browser as soon as you save the file.
This post showed you how to edit Windows hosts file. If you find any error above, please use the comment form below to report.
You may also like the post below: