How to Edit the hosts File on Windows 11

Authored by: Support.com Tech Pro Team

1. Host File Windows 11

Editing the Hosts File on Windows 11

Windows

The hosts file on Windows 11 is used to map hostnames to IP addresses and can be edited to control network traffic or block specific websites. Here's how to edit it on Windows 11:

Using Notepad with Administrator Privileges:

Open Notepad with administrator privileges. To do this, type "Notepad" in the Windows search bar, right-click on "Notepad" in the search results, and choose "Run as administrator."

In Notepad, go to "File" -> "Open" and navigate to "C:\Windows\System32\drivers\etc."

In the file dialog, set "Files of type" to "All Files" instead of "Text Documents."

Select the "hosts" file and click "Open."

Now you can edit the hosts file. Add entries in the format IP_address hostname to block or redirect websites.

When you're done making changes, save the file by clicking "File" -> "Save."

Close Notepad.

Using Command Prompt with Administrator Privileges:

Press "Win + X" and choose "Windows Terminal (Admin)" or "Command Prompt (Admin)" to open Command Prompt with administrator privileges.

To edit the hosts file using Command Prompt, type the following command:

notepad C:\Windows\System32\drivers\etc\hosts

Press "Enter."

Notepad will open the hosts file. Edit it as needed.

When you're done making changes, save the file in Notepad by clicking "File" -> "Save."

Close Notepad.

Editing the Hosts File:

In the hosts file, you can add entries to block or redirect websites. The format is IP_address hostname. For example:

127.0.0.1       example.com

This entry maps "example.com" to the loopback address, effectively blocking access to the website.

You can also add comments by placing a # at the beginning of a line.

After editing the hosts file, save it, and any changes will take effect immediately. There's no need to restart your computer.

Editing the hosts file can be useful for various purposes, such as blocking unwanted websites or redirecting domains for testing. However, be cautious when making changes, as incorrect entries can disrupt network functionality.

Contact Support.Com:

If you are still having trouble consider seeking personalized assistance from Support.Com.