On Windows 10, it’ll come the time when you may need to edit the “hosts” file to manually override the DNS settings for a particular domain or computer in the network. The hosts file has been around for a long time, and it can come in handy in many scenarios.
For example, if you’re moving a website to a new host provider, and you need to move the files to the new server before switching the domain to the new Internet Protocol (IP) address. You want to block certain websites from being accessed using your computer. Or when you don’t have a local Domain Name System (DNS) server configured in the network, and you need to map an IP address to a computer name so you can contact the device using its name.
Whatever the reason it might be, it’s very simple to edit the hosts file on Windows 10 using the Notepad.
In this guide, you’ll learn the steps to modify the hosts files on Windows 10 to map host names to IP addresses.
How to modify the ‘hosts’ file using Notepad
Use these steps to modify the hosts file, you need to add two entries, including the IP address of the remote host or application to a the friendly address you want to use:
Open Start on Windows 10.
Search for Notepad, right-click the result, and select Run as administrator.
Click on File.
Select the Open option.
Browse the following path:
Use the drop-down menu, next to “File name,” and select the All Files option.
Double-click the hosts file.
Type the IP address of the remote host followed by the domain or computer name you want to use to reach the device or application.Quick tip: Use one entry per-line.
Click on File.
Select the Save option.
Once you complete the steps, you can test the changes by opening Command Prompt and using the ping command (for example, ping google.com) to make sure the host is being reached.
If you want to block your computer from accessing certain websites, you can use the loopback address (127.0.0.1) followed by the domain name (for example, 127.0.0.1 website.com) — though, using the built-in Windows Firewall or a third-party security software can be more suitable for the job.
We’re focusing this guide on Windows 10, but you can use these instructions on Windows 8.1 and Windows 7.
Update August 15, 2019: This guide was originally published in August 2017, and it’s been revised in August 2019.