Skip to Content

How To Edit The hosts File on Windows 11


July 31st 2023


How To Edit The hosts File on Windows 11

Editing the hosts file on Windows 11 is quite similar to how it's done on previous Windows versions. The hosts file is used to map domain names to specific IP addresses, overriding the DNS resolution. To edit the hosts file and redirect a domain name to a specific IP address, follow these steps:

  1. Open File Explorer: Press the Windows key + E to open File Explorer or access it through the Start menu.
  2. Navigate to the Hosts File: The hosts file is located in the "C:\Windows\System32\drivers\etc" directory. By default, you won't see the file in the folder, as it is hidden. To make it visible, click on the "View" tab in File Explorer, and check the "Hidden items" option.
  3. Copy the Hosts File: Before editing the file, it's a good idea to create a backup. Right-click on the hosts file, select "Copy," then right-click in the same directory and choose "Paste" to create a duplicate named "hosts - Copy."
  4. Open Notepad as Administrator: To edit the hosts file, you need administrative privileges. Search for "Notepad" in the Start menu, right-click on "Notepad," and select "Run as administrator." Confirm the UAC prompt if asked.
  5. Open the Hosts File: In Notepad, go to "File" > "Open" and navigate to "C:\Windows\System32\drivers\etc." Make sure to select "All Files" from the file type dropdown to see the hosts file.
  6. Edit the Hosts File: The hosts file contains lines of text with IP addresses and domain names. To redirect a domain name to a specific IP address, add a new line at the end of the file in the following format:
    <IP Address> <Domain Name>
    Replace <IP Address> with the specific IP address you want to redirect the domain to, and <Domain Name> with the domain you want to redirect. For example:
    192.168.1.100 example.com
    This line will redirect "example.com" to the IP address "192.168.1.100."
  7. Save the Hosts File: After making the necessary changes, save the hosts file by clicking on "File" > "Save" in Notepad.
  8. Flush DNS Cache: To apply the changes immediately, you need to flush the DNS cache. Open Command Prompt as Administrator by searching for "Command Prompt" in the Start menu, right-clicking it, and selecting "Run as administrator." In the Command Prompt, type the following command and press Enter:
    ipconfig /flushdns
    This will flush the DNS cache, so your system will start using the updated hosts file.

Now, when you access the domain you've redirected in your web browser, it should go to the specified IP address instead of the regular DNS resolution. Keep in mind that this change only affects your local system, and other devices on the network won't be affected by this modification. Also important, when you’re done working on the site it is best to remove this entry. If you forget it is there you may find yourself going to the wrong site sometime in the future!


Find more technical support articles on our blog!

Google Play store page