How To'sWindows

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.


  1. GOOD Eve sir Arrows…i have a problem with my laptop….when im browsing the internet suddenly a virus invade my laptop….erasing all my files…and now d problem is i cant connect to my internet as well as my wifi….wat is your best solution to my problem? Please help. cant upload my picture, i think its code 28 and code 651.
    Troubleshooting says that an error detect in wireless and Local connection.

  2. You need to reinstall your drivers. Go to your computer/ motherboard’s manufacter’s site to find these. You can do this from another computer and then put them on a flash drive. Run them on the laptop you are having issues with.

Leave a Reply

Your email address will not be published.

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 Reimage Plus 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 Reimage by clicking the Download button below.

Download Now

I'm not interested