How to edit hosts file on Windows 10

Here are the easy steps to modify the hosts file to manually map host names to IP addresses on Windows 10.

Edit hosts file on Windows 10
Edit hosts file on Windows 10

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 app.

In this guide, you’ll learn the steps to modify the hosts files on Windows 10 to map host names to IP addresses.

Edit ‘hosts’ file using Notepad

To edit the hosts file on Windows 10, use these steps:

  1. Open Start on Windows 10.

  2. Search for Notepad, right-click the result, and select the Run as administrator option.

  3. Click on File.

  4. Select the Open option.

  5. Browse the following path: 

  6. Use the drop-down menu, next to “File name,” and select the All Files option.

  7. Double-click the hosts file.

    Hosts file location on Windows 10
    Hosts file location on Windows 10
  8. 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. (Use one entry per-line.)

    Hosts file on Windows 10
    Hosts file on Windows 10
  9. Click on File.

  10. 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 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 ( followed by the domain name (for example, — 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 11, 2020: This guide was originally published in August 2017, and it’s been revised in August 2020.

About the author

Mauro Huculak is a Windows How-To Expert who started Pureinfotech in 2010 as an independent online publication. He has also been a Windows Central contributor for nearly a decade. Mauro has over 14 years of experience writing comprehensive guides and creating professional videos about Windows and software, including Android and Linux. Before becoming a technology writer, he was an IT administrator for seven years. In total, Mauro has over 20 years of combined experience in technology. Throughout his career, he achieved different professional certifications from Microsoft (MSCA), Cisco (CCNP), VMware (VCP), and CompTIA (A+ and Network+), and he has been recognized as a Microsoft MVP for many years. You can follow him on X (Twitter), YouTube, LinkedIn and Email him at [email protected].