How-To Geek

Why Is the Localhost IP

Geeks the world over know their local host as, but why is that specific address, of all available addresses, reserved for the local host? Read on to delve into the history of local hosts.

Image by GMPhoenix; available as wallpaper here.

Today’s Question & Answer session comes to us courtesy of SuperUser—a subdivision of Stack Exchange, a community-drive grouping of Q&A web sites.

The Question

SuperUser reader Roee Adler, curious about the default localhost IP, posed the following question to the community:

I wondered what is the origin of the decision to make localhost‘s IP address What is the “meaning” of 127? what is the “meaning” of 0.0.1?

What is the meaning, indeed? While it’s possible to live out your entire geeky existence not knowing the answer to those questions, we’re ready to dig in.

The Answers

Several contributors pitched in to answer Roee’s question, each one of their contributions helps shed more light on how is the place we all call home. John T writes:

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.

Hyperslug does some archive sleuthing by digging through old memorandums on the subject:

Earliest mention I can find regarding 127’s assignment as loopback is November 1986 RFC 990 authored by Reynolds and Postel:

The address zero is to be interpreted as meaning “this”, as in “this network”.

For example, the address could be interpreted as meaning host 37 on this network.

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. 0 was used for pointing to a specific host, so that left 127 for loopback.

I know this doesn’t answer the question, but this is as far back as I could dig. It might have made more sense to choose for loopback but that was already given to BBN Packet Radio Network.

While we all know and love as the localhost, it’s worth noting that it won’t be the localhost forever. is how the localhost is designated in IPv4 communications and, as IPv6 slowly takes over, it will be designated by a much more intuitive number: 0:0:0:0:0:0:0:1.

Have something to add to the explanation? Sound off in the the comments. Want to read more answers from other tech-savvy Stack Exchange users? Check out the full discussion threads here.

Jason Fitzpatrick is a warranty-voiding DIYer who spends his days cracking opening cases and wrestling with code so you don't have to. If it can be modded, optimized, repurposed, or torn apart for fun he's interested (and probably already at the workbench taking it apart). You can follow him on if you'd like.

  • Published 10/9/12

Comments (14)

  1. Arjen M

    The article above is the technical and correct answer but not the answer to the question I think most people are thinking of when they as “why 127?”

    The answer is because of binary. 1 byte = 8 bits.
    01010101 = 85
    111111111 = 255 <– max value of 1 byte (2^8 -1)
    011111111 = 127 <– max value if you reserve the first digit as a network identifier (2^7-1)

    Each part of a network address was designed to be 1 byte long for a total of 4 bytes which is 32 bits (as in 32-bit computing which most computers still are today) for maximum efficiency when the protocol was first established.

  2. Arjen M

    Oops… i accidentally tacked on an extra digit in my example above for 255 & 127. They should be only 8 digits long. My bad.

  3. David

    These type of articles are fascinating, keep it up HTG. Also, I agree with Arjen M. response.

  4. Digital Domain Dummy

    I’d like to know if any of our authors (not necessarily HTG) have written anything about this. I’d be particularly interested in just exactly what a “sub”net is and why there seems to be a need to divide networks from clients. Mathematically, I can see why 127 may be the highest (or lowest) “client segment” and possibly why we can’t use 255 in that first octet. But why isn’t the home IP address or even!

    Like most good geeks, I already know how to convert decimal to binary (or even hex). I even know what an octet is and how certain weighted bits might be used as “masks” to form various class networks too. But why? Why mask anything? Because it would seem that once an IP address is fudged by masking that any packets will no longer go to where they are supposed to go. And yet, they do! So it would appear there is some kind of “standard” in use or at least some kind of fuzzy math involved. Can anyone explain this – clearly?! (Emphasis on “clearly” meaning easy to understand.)

    Every time I see a question like this the authors who answer always seem to go off on a tangent about binary to decimal conversion but then fall way short of actually answering. may still be home, but it’s still not very ‘clear’ as to why. Speaking for myself, this is very irritating. It’s just about as bad as the humorous error we’ve all encountered which has us seeking our systems administrator – which is us! (It’s like saying “go ask the brick wall.”)

  5. AlanWade

    Well my local host is

  6. EastWood

    I think it just defined like that at the begin of internet. If you like others, maybe you can change it somehow.

  7. Lonney

    The loop back address for IPv6 can be shortened to ::1

    C:\Windows\System32>ping ::1

    Pinging ::1 with 32 bytes of data:
    Reply from ::1: time<1ms

  8. r

    aww…”ping” –my favorite early 70’s video game

  9. snap

    One reason for subnets is to make routing cheaper. Otherwise every router on the internet need to store every host on the internet, it would cost a lot of memory, and be very innefficient. By defining networks, we can tell that all hosts on a network is behind such and such router.

  10. spike

    @AlanWade: in CMD, type route print and see if it agrees with you.

  11. John

    To AlanWade: The address 10.x.x.x is coming from your router. Its not the computers “ho0me” address.

  12. Peter Ridgers

    The loopback address ( is NOT the home address!!!

  13. Tom Jordan

    The origin of the loopback has it’s roots in serial communications. Basically the concept is that you need a way to test your side of the communication. By establishing a loopback you can issue a signal to yourself and determine by virtue of the response whether or not your system is configured correctly (eg: Ping and if you get no response then your IP has a problem and most likely your network card is either not working or incorrectly installed.). There is only one way to understand subnetting and that is to study it. Youtube has thousands of short videos on the subject and it will clear up a lot of your questions which the answers to wont make any sense anyway because you need to read up on subnetting, subnet mask, classfull and classless addressing (CIDR).

  14. AC

    I agree with @Tom Jordan. Subnetting can only be learnt by studying it and practising it. This is probably the simplest video i could find to explain the basics, (you can skip the TCP.IP stuff if you know it)

More Articles You Might Like

Enter Your Email Here to Get Access for Free:

Go check your email!