Computerhelp4all logo Articles AboutTopicsQuizzesComputer Questions & AnswersComputer Terms & DefinitionsActivitiesContact

What Is Localhost?

What Is Localhost

Date First Published: 6th March 2022

Topic: Computer Networking

Subtopic: Network Identifiers

Article Type: Computer Terms & Definitions

Difficulty: Medium

Difficulty Level: 6/10

Learn more about what localhost is in this article.

Localhost refers to one's own computer or the current device. It is the default name used for having a local server on one's own computer without the use of the internet or displaying it to the public. 127.0.0.1 is the localhost IP address, known as the loopback address, IP address. This is a reserved IP address used for testing purposes and to point a program to a local computer. With localhost, network services that are running on the host can be accessed through the loopback network interface, bypassing any local network interface hardware and the computer or hostname is currently making requests to itself rather than other devices.

Localhost is not a reserved domain name, but a reserved TLD. This means that the word 'localhost' can appear in an SLD (second-level domain), such as examplelocalhost.com, but it cannot appear as a TLD, such as mywebsite.localhost as this would cause confusion as to whether 'localhost' is a TLD, meaning the extension of the domain name, or the user's local computer, since typing 'localhost' into the address bar of a web browser will load webpages that have been created and stored on the local computer by the use of a local server, such as XAMPP. If no local server is installed, a default page will load displaying 'IIS Windows' on Windows. 127.0.0.1 is not used for communicating with other devices on a network or the internet. It is just used for accessing services on a local computer.

Note: Info Icon

It is called the loopback IP address as the information is routed back to the computer.

In web development, a local server mimics a public website since webpages can be viewed in exactly the same way as if they were publicly available and stored on a web server and it makes use of HTTP requests. However, the webpages that a user has created by a local server can only be seen on their computer and are stored locally for private use. Typing 'localhost' on a different computer would not load someone else's webpages. Virtual servers are useful for testing environments and in the development of a website, since they act like web servers and a user can build a website with programming and markup languages.

Note: Info Icon

On the internet, 127.0.0.1 is often jokingly used to refer to a home by the phrase: 'There is no place like 127.0.0.1', meaning that there is no place like home. This is because localhost and 127.0.0.1 are often referred to as the home device.

Website Blocking

Localhost can also be used for blocking harmful or distracting websites. This is performed by adding entries to the hosts file on Windows, which is located: 'Windows > System32 > Drivers > Etc > hosts'. The host file is meant to work in a similar way to DNS, since it translates IP addresses into domain names, although it is performed on a local computer rather than the internet. For example, adding the entry '127.0.0.1 (domain name)' to the hosts file will assign the IP address of the local computer (127.0.0.1) to the domain name, so that the domain name only visits localhost. Note that this has no effect on where everyone else on the internet will visit. It only alters where the domain name points to on the user's own computer.


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.