What Is The Hosts File?

What Is The Hosts File

Date First Published: 7th March 2022

Topic: Computer Networking

Subtopic: Network Identifiers

Article Type: Computer Terms & Definitions

Difficulty: Medium

Difficulty Level: 7/10

Learn more about what the hosts file is in this article.

The hosts file is a text file stored on a local computer that translates domain names to IP addresses. On Windows, the hosts file is located: 'Windows > System32 > Drivers > Etc > Hosts'. It usually consists of an IP address followed by a domain name, such as:

127.0.0.1 example.com

Adding this entry to the hosts file will translate the reserved IP address used for local computers to the domain name ‘example.com’. Whenever a user types ‘example.com’ into their web browser with that entry in their hosts file, they will visit the webpages stored on their local computer, known as localhost. If the user has not set up a virtual server on their computer, they will see a screen displaying ‘IIS Windows’ in their web browser.

Note that adding entries to the hosts file for translating IP addresses to domain names has no effect on what other users on the internet will see when they type the domain name into their web browser. It only alters where the domain name points to on a user’s local computer.

Note: Info Icon

IP addresses are always looked up by the hosts file first. If no entry is found in the hosts file, the IP address is translated into a domain name by DNS. If DNS is unable to look up the IP address, the lookup fails.

Website Blocking

Adding entries to the hosts file can be used for blocking malicious or distracting websites, since when the local IP address (127.0.0.1) followed by the domain name is typed into the hosts file, the user will only visit webpages stored on their local computers or if there are no webpages, a screen with ‘IIS Windows’ will be displayed.

Do Smartphones and Tablets Have A Hosts File?

Most smartphones and tablets do not have a hosts file. On iOS devices, the hosts file does not exist. However, it is possible for rooted Android devices to have a modifiable hosts file, which can be edited with ES File Explorer.


Feedback

  • Is there anything that you disagree with on this page?
  • Are there any spelling, grammatical, or punctuation errors on this page?
  • Are there any broken links or design errors on this page?

If so, it is important that you tell me as soon as possible on this page.