How to easily edit Host file in Windows 11?

In this blog post, you’ll learn how to edit your Windows 11 Host file in simple steps.

What is Host file in Windows?

The Host file in Windows 11 is a special file that lets you map specific domain names to an IP address manually instead of doing it automatically via the DNS (Domain Name System).

After you made changes to the host.config file, Windows 11 will look for the specific hostname from your Host file in order to connect to the IP address mentioned in the file instead of depending on the DNS provider.

Uses of Host file in Windows 11

There are plenty of uses of the Host file in Windows 11

  • You can block the users from accessing specific websites
  • Developer Testing a website before it goes live. We use this technique a lot when we want to test it on BLUE GREEN Deployments.

How to easily edit Host file in Windows 11?

Follow the below steps to edit the Hostfile in Windows 11.

  • Ensure that you take a backup of the host.config file and store it somewhere.
  • Navigate to the Start Menu search bar in Windows 11 and type “notepad” and ensure that you run the notepad as administrator.
  • Click on the File Menu in Notepad and then select “Open” and then enter the following file path of the host file.
  • Click on Open

This will open the Host file on your Notepad. You can now edit the host.config file from here.

Enter the IP address with the domain name to set up the mapping inside the host config file.

For example, if you want to point to IP address, then enter the specified IP address followed by space and then the domain name.

How to easily edit Host file in Windows 11?

If you have # before the beginning of the line, that means it’s a comment and will be ignored by windows.

Once you are done with the changes, save the host file by using the shortcut key “Ctrl” + “S”. Restart your PC if necessary.

When you try the above, it will block the website You will be able to add multiple websites in the same file.