A hosts file is a local file stored on the computer that translates domain names or NetBIOS names into an IP addresses. For example, in the example below, the line translates 22.214.171.124 into the Google domain.
Example of hosts file line
When looking up an IP address, the computer will first look at the hosts file to resolve the name. If the name is not in the local hosts file, it will try resolving using a Domain Name Service (DNS), and if also not found the lookup will fail.