Why Is Localhost’s IP Address It’s Meaning And Use

Have you wondered what is local host’s IP and what it actually is?

If you are on Internet 24×7 you might have definitely heard or seen an IP address during your time on the net. The geeky nerds among you might know that points to localhost. But do you know why is localhost‘s IP address and not something else?

The basic logic behind this address is that it is used to establish a connection to the same computer used by the end-user. Below is a detailed answer by a user on Super User forum.

How does work? Why is it called so?

Here is a geeky answer from a techie :

127 is the last network number in a class A network with a subnet mask of is the first assignable address in the subnet. cannot be used because that would be the wire number. But using any other numbers for the host portion should work fine and revert to using127.0.0.1. You can try it yourself by pinging if you’d like. Why they waited until the last network number to implement this? I don’t think it’s documented.

Most developers use local host to test their applications before actually deploying it. When you try to establish a network connection to the loopback address, it works in the same manner as making a connection with any remote device. However, it avoids connection to the local network interface hardware.

But, why does the localhost IP address starts with 127? Well, 127 is the last network number in a class A network. It has a subnet mask of So, the first assignable address in the subnet is

However, if you use any other numbers from the host portions, it should work fine and revert to So, you can ping if you like.

You might also ask why the last network number was chosen to implement this. Well, the earliest mention of 127 as loopback dates back to November 1986 RFC 990. And, by 1981, 0 and 127 were the only reserved Class A networks.

The class A network number 127 is assigned the “loopback” function, that is, a datagram sent by a higher level protocol to a network 127 address should loop back inside the host. No datagram “sent” to a network 127 address should ever appear on any network anywhere. Even as early as September 1981 RFC 790, 0 and 127 were already reserved:
000.rrr.rrr.rrr                 Reserved                     [JBP]
127.rrr.rrr.rrr                 Reserved                     [JBP]

0 and 127 were the only reserved Class A networks by 1981. Out of the two available localhosts, 0 was used for pointing to a specific host and that left 127. So all developers testing their apps and websites have to use 127  for loopback. Some would also call it more sensible to choose for loopback, but that was already given to BBC Packet Radio Network.

You can find more information and discussion about local host from Stack Exchange users here.


Please enter your comment!
Please enter your name here

Read More

Suggested Post