The Host File helps block ads, trackers, or third-party websites to protect your privacy. Host files are also useful for developers to test their applications when the app cannot resolve an IP via DNS or needs to resolve to a different IP than the public DNS IP. Sometimes, you may need to edit the host file on Windows 11 for personal purposes, and whatever the reason, you can do that with the shared guide below.
Guide to editing the host file in Windows 11
1. Use Notepad.
2. Use Command Prompt.
How to edit the host file on Windows 11
There are two ways to edit the host file on Windows 11. The first method involves creating a copy of the original file and then replacing it in Notepad. The second method is using the command line.
1. Edit the host file on Windows 11 with Notepad
The easiest way to edit the host file on Win 11 is to create a copy of it and then replace the original in the 'etc' folder.
First, you create a copy of the hosts file with the following steps:
Step 1: Press the Windows + E shortcut to open File Explorer.
Step 2: Next, paste the following path into File Explorer and press Enter:
%SystemRoot%\System32\drivers\etc\
Step 3: In the list of files, you will find a file named host. Copy and paste it onto the Desktop screen.
Now, you can proceed to edit the host file on Windows 11 using Notepad following the instructions below:
Step 1: Type Notepad in Windows Search and right-click on the corresponding search result, select Run as administrator.
Step 2: Next, drag the hosts file from the Desktop into the Notepad window.
Step 3: Add the new IP address and domain name to the end of the file. For example, in this article, Mytour adds 192.168.1.10 BOBPC.
Step 4: Press the Ctrl + S shortcut to save the file and close Notepad.
Step 5: Now, drag the hosts file from the Desktop and drop it into the File Explorer window.
Step 6: In the Replace or Skip Files dialog, select Replace the file in the destination.
Step 7: In the Destination Folder Access Denied dialog, click Continue. You may need to agree or be prompted to enter the username and administrator password to complete the operation.
Step 8: You open the NotePad application again and drag the hosts file from File Explorer into the Notepad window.
Step 9: Now, you will see your new entry in the hosts file.
- Read more: How to adjust date and time on Windows 11
2. How to edit the host file on Windows 11 using Command Prompt
This method utilizes the command line and is much faster than the first approach. Follow these steps:
Step 1: Type cmd in Windows Search and right-click on the corresponding search result, select Run as administrator or click Run as administrator in the right-side panel.
Step 2: Click Yes or provide the username and administrator password when prompted to perform the action.
Step 3: In the Command Prompt window, use the echo command below to add the new IP address and domain name to the hosts file. In this example, Mytour adds 192.168.1.12 TOMPC to the hosts file.
echo 192.168.1.12 TOMPC >> %SystemRoot%\System32\drivers\etc\hosts
Step 4: To check if the hosts file has been updated, use the type command below:
type %SystemRoot%\System32\drivers\etc\hosts
So, you have successfully edited the host file in Windows 11. While Windows 11 may look different from Windows 10, most basic elements remain the same, especially the file and folder structure on the Windows system. You can easily navigate and use Windows 11 tricks similar to those you used in Windows 10.
In addition, if you're not accustomed to the right-click menu on Windows 11 and want to bring the right-click menu from Windows 10 to Windows 11 for usage, you can check out the guide here and follow along.
- Explore more: How to make the Windows 11 right-click menu resemble Windows 10