Find and edit hosts in Windows 10

On Windows computer, there is a system file named hosts that maps hostnames to IP addresses. It allows Windows users to specify an IP address to use for a hostname or domain name without checking DNS. For example, if you want to test your website or software locally, you can configure your site or software to use a custom domain other than localhost. In this case, you can map your custom domain to the local IP address of your computer. In this article, we will show you where to find hosts file in Windows 10 and how to edit it on your PC.

If you have upgraded to Windows 11, check out this tutorial to edit hosts files in Windows 11.

Find hosts file in Windows 10

Open the Windows File Explorer on your PC, browse to C:/Windows/System32/drivers/etc/, you can then find the hosts file without a file extension.

find, edit hosts file windows 10 - map domain, hostname to ip
find, edit hosts file windows 10 – map domain, hostname to ip

Edit hosts file in Windows

It is a plain text file. You can use Notepad, a built-in software for Windows, to open, view and edit the hosts file on your PC. You can also use third-party text editors, such as Editplus, Notepad++, to edit hosts file in Windows.

Before you make changes to this file, make sure to duplicate so you can restore it to the original status if needed.

To redirect a domain or hostname to your local machine, add some line like this.

127.0.0.1       localhost
127.0.0.1       yourdomain.com

To map a domain or hostname to an IP, add some line like this.

98.138.219.231      yoursite.com
xxx.xxx.xxx.xxx      yourdomain.com
xxx.xxx.xxx.xxx      www.yourdomain.com

On the other end, if you want to block a website, you can simply point the domain to your local computer or an invalid IP address. See this guide to block websites using Hosts in Windows 10.

Leave a Reply