The hosts file in Windows is used to control how your computer resolves domain names. By updating a host’s file entry, you can point a domain to a specific IP address without changing public DNS settings. This article walks through the steps to update the hosts file on Windows.
What is a Hosts File?
You can set IP addresses for a domain on your local system by editing the hosts file, which can override the authoritative DNS. It can allow you to check what a domain will show if it’s pointed to a different server.
The hosts file will be edited to block certain hostnames (like advertising/malicious hosts), or used for web development purposes, i.e. to redirect domains to local addresses.
Windows
To access the host file in Windows XP, Vista, 7, 8x, and 10, you have to use the following command in the Run Line to open the file with Notepad.
- Press the Windows + R keys to Run Line.
- Copy the below-mentioned command and paste it into the Run Line.
notepad c:\windows\system32\drivers\etc\hosts
- When the screen is open, you can edit the host file.
For example, we will block Facebook. To block Facebook, just enter the line after the # mark in the hosts file.
0.0.0.0 www.facebook.com
- Now that you have edited your Hosts file, save it.

- Now, observe if we try to reach Facebook in the IE browser, we can’t get to the page.

- We also were not able to access it in Google Chrome.

If you find any difficulty with this, please feel free to get in touch with our support team.