What is the hosts file?

The hosts file is where you can manually add host-names (domain names) and IP address pair. It’s a local file store in the computer that translates (mapping) domain names to an IP addresses. When the computer looking up an IP address, it will first look at the hosts file to resolve the name. If the name is not in the local hosts file it will try to resolve using a Domain Name Service (DNS).

The hosts file can bypass the DNS server. Modifying the hosts file on your local computer to look directly at the IP address specified and its enables to override the DNS on that particular Computer. Mapping the IP address with their Host names also resolve DNS issues.

If you specify and IP address and its corresponding host name, the work of DNS becomes simpler, thereby making the lookup faster, and It helps to access the web site or web page more easily. The Hosts file can also be used to block any website on your computer.

How To Edit Or Modify The Hosts File On Windows Operating System?


Why do we need to edit hosts file?

There are variety of reasons as to why we will need to edit, modify the hosts file on our computer.We will look Some common reasons for this..

1.  Network Testing.
When we have new or transferred domain names its will have a delay period time that can be anywhere from a few hours to a few days. During this period of time the new or transferred domain information circulate around the internet, and is normally unavailable. If we want to update our site instantly and we don’t like to wait for the propagation of domain information on the internet, we can edit our hosts file to access the website only from our computer which the hosts file was modified.

2.  Block Ad Networks and Spyware. 
This reason is very popular reason to edit the hosts file. If we add lists of known ad network and spyware sites into the hosts file our own computer IP (127.0.0.1) address, the computer won’t able to reached those ad network and spyware sites.  So because of this, browsing speed up and will be more secure the computer known malicious sites.

What is the Hosts file location in Windows 10, Win 8.1, Win 8, Windows 7, Win Vista, Win xp ?
c:\windows\system32\drivers\etc\hosts

How To Edit Or Modify The Hosts File On Windows 10, 8.1, 8?

01. Type Notepad in the windows search field.

How to edit modify the Hosts file windows 10, windows 8.1, or windows 8?

02. In the search results, right-click on the Notepad and select Run as administrator.

how to edit the hosts file windows 10, windows 8.1 or windows 8?

03. Click Yes on the Windows needs your permission UAC window.

04. Now on the Notepad, Open the hosts file C:\Windows\System32\drivers\etc\hosts

how to edit the hosts file windows 10, windows 8.1 or windows 8?
how to edit the hosts file windows 10, windows 8.1 or windows 8?
how to edit the hosts file windows 10, windows 8.1 or windows 8?

05. Make the necessary changes on the hosts file.

how to edit the hosts file windows 10, windows 8.1 or windows 8?

In this example we will block Facebook website. To do that just enter in the following line like that in the picture.

05. Click File > Save to save your changes.

how to edit the hosts file windows 10, windows 8.1 or windows 8?

Now if we try to access Facebook, we can not access the page.

how to edit the hosts file windows 10, windows 8.1 or windows 8?

How to edit the hosts file Windows 7, Windows Vista, Windows NT, Windows 2000, and Windows XP ?

01. Press Windows key + R form your keyboard.

how to edit the hosts file windows 7, windows xp

02. Enter following command in the Run Line to open the hosts file through Notepad.

notepad c:\windows\system32\drivers\etc\hosts

how to edit the hosts file windows 7, windows xp

03. Click Continue the Windows needs your permission UAC window.( For Windows 7 and Vista)

04. Make the necessary changes and save the file( File > Save).