Let’s have a look at this article on how to edit hosts file in Windows 11. A Windows hosts file is a text file that saves information that is used to map servers, or “hostnames to IP addresses”. Although DNS (domain name service) is mainly used for IP resolution now, Windows still stores the host file.
Sometimes, you might have to edit the Windows hosts file. Editing the host file permits you to trick your system into resolving to a special IP address that you need. There could be multiple reasons for you wanting to edit the Windows host file. Maybe you are working with a domain name-independent application. Or you are leaving an old system and would like to test your domain before moving the DNS configuration. No matter what the reason, it is very simple to edit the hosts file in Windows 11.
Table of Contents
Solving IP address for a domain easily in the hosts file on Windows 11
Backup Your Hosts File
Before editing the Windows hosts file, you must take a backup of the system hosts file. In case something goes wrong, you should be able to recover the host file to a version that worked.
Open the file explorer on your system, and then go to the C:\Windows\System32\drivers\etc directory. If Windows is installed on another drive, you would have to change the drive from C: to the drive where Windows OS is installed on your system.
Additionally, you can also copy and paste the path below in the run command or in the file explorer address and hit enter to launch the host file folder.
C:\Windows\system32\drivers\etc
You can see a file with the name hosts in this location. Copy the hosts file and save it in another location for backup. It will ask for administrator permission to do that.
Edit Hosts File with Notepad in Windows 11
First, you need to open Notepad as an administrator. To do so, search ‘Notepad’ in the Windows search bar and then select Run as administrator.
Windows will pop up a permission prompt asking, “Do you want to allow this app…” Click on the Yes button. This will open the notepad with admin rights, so you can edit the Windows hosts file using it.
In Notepad, click on the File menu and then select Open.
Then, copy and paste the host file address given below in the File name field, and then hit enter.
C:\Windows\System32\drivers\etc\
Click on the hosts file and then choose open.
Edit Hosts File
The hosts file will open in Notepad, and now you can edit it easily.
Add the IP addresses and domain names that you wish to resolve at the end of the file and save it. As we opened Notepad in admin mode, you would be able to easily save it without any further permissions. Visit Microsoft for more details.
And that’s it. We have successfully modified our host file in Windows 11.