How to edit HOSTS file on Windows

On Home windows 11 (and 10), you possibly can edit the “Hosts” file to manually override the system’s Area Identify System (DNS) settings for a selected web area (web site) or system linked to the native community.

Normally, you don’t have to fret about manually mapping an IP tackle to a site title utilizing the Hosts file positioned within the C:WindowsSystem32Driversetc path on Home windows 11. (It’s the identical path on Home windows 10.) Nevertheless, it may well come in useful in lots of eventualities. As an example, whenever you need to block sure web sites. While you don’t have an area DNS server within the community, you will need to map an IP tackle to a pc title or put together an internet site switch to a brand new internet hosting supplier.

No matter your cause, Home windows 11 and Home windows 10 make it tremendous easy to edit the Hosts file utilizing Notepad or another textual content editor so long as you open the app as an administrator. In any other case, you received’t have the ability to edit the file. As well as, the PowerToys app features a device that makes it simpler to handle entries within the Hosts file. Alternatively, you too can use Command Immediate to edit the Hosts file.

On this information, you’ll study the steps to change the Hosts information on Home windows (11 and 10) to map host names to IP addresses.

Edit Hosts file on Home windows from PowerToys

To edit the Hosts information with the PowerToys editor, use these steps:

  1. Open PowerToys.

  2. Click on on Hosts File Editor.

  3. Below the “Activation” part, click on the “Launch Hosts File Editor” possibility.

    PowerToys Hosts File Editor

  4. Click on the Settle for button for the warning.

  5. Click on the New entry button.

    Hosts File Editor new entry

  6. Affirm the IP tackle, hostname, and remark (as crucial).

    Windows 11 edit Hosts file

  7. Activate the Lively button.

  8. Click on the Add button.

  9. (Optionally available) Proper-click the entry and select the “Delete” possibility for a selected configuration.

After you full the steps, the Hosts file will save with the brand new entries, and you need to now have the ability to check the brand new configuration. Within the editor, you possibly can allow or disable entries with a toggle swap.

Edit Hosts file on Home windows from Notepad

To edit the “Hosts” file on Home windows with Notepad, use these steps:

  1. Open Begin.

  2. Seek for Notepad, right-click the highest consequence, and choose the Run as administrator possibility.

  3. Click on on File and choose the Open possibility.

  4. Browse to the Hosts file location: 

  5. Use the drop-down menu subsequent to “File title” and choose the “All Recordsdata” possibility.

  6. Choose the Hosts file.

    Open hosts file

  7. Click on the Open button.

  8. In a brand new line, enter the IP tackle of the distant server, add no less than one area, and ensure the area title or laptop title to achieve the service. For instance, #This PC redirects to the required IP tackle.

    Windows 11 edit hosts file

    Fast word: If you wish to add one other entry, use a brand new line and don’t use the pound signal (#) since that image is just used for commenting.
  9. (Optionally available) Kind the next line to dam a selected web site (for instance, Fb): #This PC will block entry to Fb

  10. (Optionally available) Delete the whole line to take away the entry from the Hosts file.

  11. Click on on File.

  12. Choose the Save possibility.

When you full the steps, you possibly can check the adjustments by opening Command Immediate and utilizing the ping command to make sure the host is reachable.

If you wish to block your laptop from accessing sure web sites, you need to use the loopback tackle ( adopted by the area title ( web Additionally, when you can edit the “Hosts” file on Home windows 11, it’s since you want administrative permissions.

Edit Hosts file on Home windows from Command Immediate

To edit the “Hosts” file via Command Immediate, use these steps:

  1. Open Begin.

  2. Seek for Command Immediate, right-click the highest consequence, and choose the Run as administrator possibility.

  3. Kind the next command so as to add one other entry to the Hosts file and press Enter:

    echo >> %SystemRootpercentSystem32driversetchosts

    Within the command, change “” for the entry you need to embrace within the file.

    Command Prompt edit Hosts

  4. (Optionally available) Kind the next command to verify the adjustments and press Enter:

    sort %SystemRootpercentSystem32driversetchosts

After you full the steps, the entry will likely be added to Hosts file. 

Because the Hosts file is a textual content file, if you wish to take away an entry, the best solution to full this configuration from Command Immediate is to run the notepad %SystemRootpercentSystem32driversetchosts command to open the file and delete the road to take away the entry and save the file.

Replace April 22, 2024: This information has been up to date to make sure accuracy and mirror adjustments to the method utilizing Command Immediate.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button