# Why is it 127.0.0.1 anyway?

**URL:** <https://boards.straightdope.com/t/why-is-it-127-0-0-1-anyway/614495>\
**Category:** Factual Questions\
**Created:** [March 1, 2012, 11:05pm UTC](https://boards.straightdope.com/t/why-is-it-127-0-0-1-anyway/614495 "2012-03-01T23:05:33Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![trabajabamos](https://avatars.discourse-cdn.com/v4/letter/t/47e85d/32.png) [@trabajabamos](https://boards.straightdope.com/u/trabajabamos)\
**Post date:** [March 1, 2012, 11:05pm UTC](https://boards.straightdope.com/t/why-is-it-127-0-0-1-anyway/614495/1 "2012-03-01T23:05:33Z")

</div>

Call it whatever you want: “home”, “localhost”, “loopback”, etc. Make a Wizard of Oz joke about it if you must. But tell me why is it 127.0.0.1.

From my own research I understand that the block of IP addresses 127.0.0.0/8 is designated for this purpose by the impressively named Internet Assigned Numbers Authority. And I can accept that “127” was just an arbitrary choice because it is halfway between 0 and 255. But I can’t shake the feeling that there is some significance to that “1.”

It could just as easily be 127.0.0.0 or 127.0.0.2. But it isn’t. Why not?

---

<div class="post-metadata">

**Author:** ![Francis\_Vaughan](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/francis_vaughan/32/3093_2.png) [@Francis\_Vaughan](https://boards.straightdope.com/u/Francis_Vaughan)\
**Post date:** [March 1, 2012, 11:13pm UTC](https://boards.straightdope.com/t/why-is-it-127-0-0-1-anyway/614495/2 "2012-03-01T23:13:49Z")

</div>

You can’t use 0 in any address range, that is reserved as the broadcast address (refers to the entire subnet.) So 127.0.0.1 is the first available address in the 127.0.0 range. 127 is 0x8F in hex , or 01111111 in binary. so in a computer engineer’s world is a nice number - in much the same way that 999, and 99 are in decimal.

---

<div class="post-metadata">

**Author:** ![trabajabamos](https://avatars.discourse-cdn.com/v4/letter/t/47e85d/32.png) [@trabajabamos](https://boards.straightdope.com/u/trabajabamos)\
**Post date:** [March 1, 2012, 11:18pm UTC](https://boards.straightdope.com/t/why-is-it-127-0-0-1-anyway/614495/3 "2012-03-01T23:18:58Z")

</div>

I probably would have noticed that if I’d bothered to experimentally ping 127.0.0.0, which I now see doesn’t actually work…

:smack:

---

<div class="post-metadata">

**Author:** ![friedo](https://avatars.discourse-cdn.com/v4/letter/f/8edcca/32.png) [@friedo](https://boards.straightdope.com/u/friedo)\
**Post date:** [March 2, 2012, 2:24am UTC](https://boards.straightdope.com/t/why-is-it-127-0-0-1-anyway/614495/4 "2012-03-02T02:24:47Z")

</div>

127 was chosen because it was the highest first octet in a Class A network (back when [classful routing](http://en.wikipedia.org/wiki/Classful_routing) was used.) The rest of the network number was chosen because it’s all zeroes, which is easy to remember. Any node number from 1 to 255 will work for loopback. (Try pinging 127.0.0.42; it will work.)

As **Francis** points out, you can’t use all zeroes since that’s the broadcast address.

---

<div class="post-metadata">

**Author:** ![goldmund](https://avatars.discourse-cdn.com/v4/letter/g/a4c791/32.png) [@goldmund](https://boards.straightdope.com/u/goldmund)\
**Post date:** [March 2, 2012, 3:11am UTC](https://boards.straightdope.com/t/why-is-it-127-0-0-1-anyway/614495/5 "2012-03-02T03:11:54Z")

</div>

Actually, 127.0.0.0 would be the network address, not the broadcast address. A subnet itself has an address, which is the first IP in the subnet.

The broadcast addre ss is the highest address in the subnet. In the case of 127.0.0.0/8, the broadcast address would be 127.255.255.255.

---

<div class="post-metadata">

**Author:** ![dzero](https://avatars.discourse-cdn.com/v4/letter/d/5f9b8f/32.png) [@dzero](https://boards.straightdope.com/u/dzero)\
**Post date:** [March 2, 2012, 4:54am UTC](https://boards.straightdope.com/t/why-is-it-127-0-0-1-anyway/614495/6 "2012-03-02T04:54:40Z")

</div>

> [@Francis\_Vaughan](#):
>
> You can’t use 0 in any address range, that is reserved as the broadcast address (refers to the entire subnet.) So 127.0.0.1 is the first available address in the 127.0.0 range. 127 is 0x8F in hex , or 01111111 in binary. so in a computer engineer’s world is a nice number - in much the same way that 999, and 99 are in decimal.

> [@friedo](#):
>
> 127 was chosen because it was the highest first octet in a Class A network (back when [classful routing](http://en.wikipedia.org/wiki/Classful_routing) was used.) The rest of the network number was chosen because it’s all zeroes, which is easy to remember. Any node number from 1 to 255 will work for loopback. (Try pinging 127.0.0.42; it will work.)
> 
> As **Francis** points out, you can’t use all zeroes since that’s the broadcast address.

> [@goldmund](#):
>
> Actually, 127.0.0.0 would be the network address, not the broadcast address. A subnet itself has an address, which is the first IP in the subnet.
> 
> The broadcast addre ss is the highest address in the subnet. In the case of 127.0.0.0/8, the broadcast address would be 127.255.255.255.

Once more in awe of SDMB. That is all.

---

<div class="post-metadata">

**Author:** ![Phlint](https://avatars.discourse-cdn.com/v4/letter/p/c89c15/32.png) [@Phlint](https://boards.straightdope.com/u/Phlint)\
**Post date:** [March 2, 2012, 4:57am UTC](https://boards.straightdope.com/t/why-is-it-127-0-0-1-anyway/614495/7 "2012-03-02T04:57:29Z")

</div>

Also, you can use the 0 in an address range. Any network block greater than a /24 will have at least one valid IP address ending in .0.

Example: For the network 10.0.0.0/23 you have  
Network Address: 10.0.0.0  
Broadcast Address: 10.0.1.255  
Available Addresses: 10.0.0.1 - 10.0.1.254

The range of available addresses includes the valid addresses of 10.0.0.255 and 10.0.1.0. There’s nothing technically wrong with using those addresses; however, they’re typically not used to avoid confusion.

---

<div class="post-metadata">

**Author:** ![Number](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/number/32/242_2.png) [@Number](https://boards.straightdope.com/u/Number)\
**Post date:** [March 2, 2012, 6:39am UTC](https://boards.straightdope.com/t/why-is-it-127-0-0-1-anyway/614495/8 "2012-03-02T06:39:23Z")

</div>

One further point is that, in 20/20 hindsight, it was a mistake to devote such a huge chunk of address space to the loopback function. It would have worked just as well to use a Class C network, or even (as was later done with IPv6) a single address. The decision was made back in the early 80s, when nobody could have anticipated the worldwide explosion of Internet usage, and the resulting shortage of routable IPv4 addresses.

---

<div class="post-metadata">

**Author:** ![gotpasswords](https://avatars.discourse-cdn.com/v4/letter/g/c57346/32.png) [@gotpasswords](https://boards.straightdope.com/u/gotpasswords)\
**Post date:** [March 2, 2012, 2:45pm UTC](https://boards.straightdope.com/t/why-is-it-127-0-0-1-anyway/614495/9 "2012-03-02T14:45:16Z")

</div>

Speaking of IPV6 - the IPV6 equivalent to 127.0.0.1 is **::1**.

I’ve got a t-shirt that says “There’s no place like ::1” Yes, I’m a geek, thanks for noticing! 😃

---

<div class="post-metadata">

**Author:** ![drbhoneydew](https://avatars.discourse-cdn.com/v4/letter/d/d78d45/32.png) [@drbhoneydew](https://boards.straightdope.com/u/drbhoneydew)\
**Post date:** [March 2, 2012, 3:42pm UTC](https://boards.straightdope.com/t/why-is-it-127-0-0-1-anyway/614495/10 "2012-03-02T15:42:01Z")

</div>

> [@Phlint](#):
>
> Also, you can use the 0 in an address range. Any network block greater than a /24 will have at least one valid IP address ending in .0.
> 
> Example: For the network 10.0.0.0/23 you have  
> Network Address: 10.0.0.0  
> Broadcast Address: 10.0.1.255  
> Available Addresses: 10.0.0.1 - 10.0.1.254
> 
> The range of available addresses includes the valid addresses of 10.0.0.255 and 10.0.1.0. There’s nothing technically wrong with using those addresses; however, they’re typically not used to avoid confusion.

Quite. That x.y.z.0 doesn’t have to be a network address makes more sense in the underlying binary (same example):

00001010000000000000000000000000 : Network Address  
11111111111111111111111000000000 : Subnet mask for /23 (1s mark the network portion, 0s the host - {IP address} AND {Subnet mask} = {Network address for that IP address})  
00001010000000000000000111111111 : Broadcast address (all 1s for host portion)

Everything between the network address and broadcast address in binary is a valid address on that network. How they come out in decimal notation should not matter.

---

<div class="post-metadata">

**Author:** ![jharvey963](https://avatars.discourse-cdn.com/v4/letter/j/54ee81/32.png) [@jharvey963](https://boards.straightdope.com/u/jharvey963)\
**Post date:** [March 2, 2012, 6:28pm UTC](https://boards.straightdope.com/t/why-is-it-127-0-0-1-anyway/614495/11 "2012-03-02T18:28:10Z")

</div>

> [@Francis\_Vaughan](#):
>
> … 127 is 0x8F in hex , or 01111111 in binary…

A nit: 127 is 0x7f in Hex.

(Yeah, I know, there’s one in every crowd. 😃 )

J.

---

<div class="post-metadata">

**Author:** ![Bytegeist](https://avatars.discourse-cdn.com/v4/letter/b/9dc877/32.png) [@Bytegeist](https://boards.straightdope.com/u/Bytegeist)\
**Post date:** [March 2, 2012, 8:04pm UTC](https://boards.straightdope.com/t/why-is-it-127-0-0-1-anyway/614495/12 "2012-03-02T20:04:04Z")

</div>

> [@gotpasswords](#):
>
> Speaking of IPV6 - the IPV6 equivalent to 127.0.0.1 is **::1**.
> 
> I’ve got a t-shirt that says “There’s no place like ::1”

Hmmmm. “There’s no place like _localhost_” ??

---

<div class="post-metadata">

**Author:** ![Blakeyrat](https://avatars.discourse-cdn.com/v4/letter/b/ecd19e/32.png) [@Blakeyrat](https://boards.straightdope.com/u/Blakeyrat)\
**Post date:** [March 2, 2012, 8:39pm UTC](https://boards.straightdope.com/t/why-is-it-127-0-0-1-anyway/614495/13 "2012-03-02T20:39:42Z")

</div>

> [@dzero](#):
>
> Once more in awe of SDMB. That is all.

Why? This is like first-day (or first-week at least) in any networking class. It’s not exactly esoteric knowledge…

I mean some of the threads here, yeah, be in awe of them. This one is just “page 10 of any textbook on the subject.”
