How to Edit The Hosts File On Windows 7/8 and 10

The hosts file in Windows is used to map the IP address to a domain. It can be used to block access to domains, by mapping the host name to an incorrect ip address or a local ip address. If a host is mapped in the host file, Windows will not query the DNS server for the resolution.

The default location for the hosts file is C:\Windows\System32\drivers\etc, the file has no format and needs to be opened using notepad or another text editor.

The user will need administrator permissions to edit the host files in windows – So Let’s get started!

Firstly, open notepad as administrator:

For Windows 7/Vista:

Click Start and type notepad in the search bar, right click on the notepad file and select run as administrator

For Windows 8/8.1/10:

In the tiles mode, type notepad and right click on it and then choose rus as administrator

Once you have the notepad open, Click File -> Open and get into the folder  C:\Windows\System32\drivers\etc you may not see any files listed in there, so be sure to select All Files and then double click the hosts file to open it.


Now double click the hosts file and open it. This will open the Hosts file in notepad as administrator. Entries, in the hosts file are in the following format:   localhost

if a line has a # before, eg: #       localhost, then it is commented out and will not function. To add an entry to host files, add the line just below this line, without the #. The correct format is



Once this is entered, Click File -> Save to save the hosts file, or press CTRL + S keys. If you wish to edit it later, simply re-open the file, make the modification and save it again.


There are various uses for the hosts file, ex: i used to use it to test local website, on a domain without actually having to buy the domain.

Kevin Arrows
Kevin is a dynamic and self-motivated information technology professional, with a Thorough knowledge of all facets pertaining to network infrastructure design, implementation and administration. Superior record of delivering simultaneous large-scale mission critical projects on time and under budget.

Expert Tip

How to Edit The Hosts File On Windows 7/8 and 10

If the issue is with your Computer or a Laptop you should try using Restoro which can scan the repositories and replace corrupt and missing files. This works in most cases, where the issue is originated due to a system corruption. You can download Restoro by clicking the Download button below.

Download Now

I'm not interested