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. The hosts file has been around for a long time in Windows, 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 IP address. You want to block certain websites from being accessed using your computer. Or when you don’t have a local 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. However, the instructions are the same for Windows 8.1, Windows 7, and previous versions.
How to modify the ‘hosts’ file using Notepad
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.
Search for Notepad, right-click the result, and select Run as administrator.
Click on File, and select Open.
Browse the following path:
Select All Files from the drop-down menu.
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, and select Save.
Once you completed the steps, you can test the changes by opening Command Prompt and using the ping command (e.g., 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 (e.g., 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.