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 Windows from PowerToys
- Edit Hosts file on Windows from Notepad
- Edit Hosts file on Windows from Command Prompt
Edit Hosts file on Home windows from PowerToys
To edit the Hosts information with the PowerToys editor, use these steps:
-
Open PowerToys.
-
Click on on Hosts File Editor.
-
Below the “Activation” part, click on the “Launch Hosts File Editor” possibility.
-
Click on the Settle for button for the warning.
-
Click on the New entry button.
-
Affirm the IP tackle, hostname, and remark (as crucial).
-
Activate the Lively button.
-
Click on the Add button.
- (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:
-
Open Begin.
-
Seek for Notepad, right-click the highest consequence, and choose the Run as administrator possibility.
-
Click on on File and choose the Open possibility.
-
Browse to the Hosts file location:
C:WindowsSystem32Driversetc
-
Use the drop-down menu subsequent to “File title” and choose the “All Recordsdata” possibility.
-
Choose the Hosts file.
-
Click on the Open button.
-
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,
159.223.126.251 google.com #This PC redirects Google.com to the required IP tackle
.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. -
(Optionally available) Kind the next line to dam a selected web site (for instance, Fb):
127.0.0.1 fb.com #This PC will block entry to Fb
-
(Optionally available) Delete the whole line to take away the entry from the Hosts file.
-
Click on on File.
-
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 (127.0.0.1) adopted by the area title (127.0.0.1 web site.com). 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:
-
Open Begin.
-
Seek for Command Immediate, right-click the highest consequence, and choose the Run as administrator possibility.
-
Kind the next command so as to add one other entry to the Hosts file and press Enter:
echo 159.223.126.251 google.com >> %SystemRootpercentSystem32driversetchosts
Within the command, change “159.223.126.251 google.com” for the entry you need to embrace within the file.
-
(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.