Are all 127 IP addresses loopback?

Geeks the world over know their local host as 127.0.0.1, 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 127.0.0.1. 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 127.0.0.1 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 255.0.0.0127.0.0.1 is the first assignable address in the subnet. 127.0.0.0 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 127.1.1.1 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 0.0.0.37 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 1.0.0.0 for loopback but that was already given to BBN Packet Radio Network.

While we all know and love 127.0.0.1 as the localhost, it’s worth noting that it won’t be the localhost forever. 127.0.0.1 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.

Readers like you help support MUO. When you make a purchase using links on our site, we may earn an affiliate commission. Read More.

There are a few IP addresses that are useful to know off by hand---your router's IP, for example. One of the lesser-known IP addresses you should know is 127.0.0.1, but what does it connect to and when should you use it?

Let's explore what 127.0.0.1 is, and what it can do.

What Is 127.0.0.1?

127.0.0.1 is known as a loopback address, but you may see it under the name "localhost." When you point your browser to 127.0.0.1, it tries to connect to the computer you're using right now. This is handy when you want to connect to a server on your own computer.

127.0.0.1 is special among IP addresses. Typically, an IP address is unique to every computer on both your local network and the internet. 127.0.0.1, however, always points to the computer you're currently using no matter what.

For example, if you set up a server on Computer A, you can connect to it by visiting 127.0.0.1 on Computer A. However, if you move to Computer B and type in 127.0.0.1, you'll connect to Computer B instead of A. You'll need either Computer A's internet or local network IP address to connect to it from Computer B.

What's the Difference Between 127.0.0.1 and Localhost?

There is no real difference between 127.0.0.1 and localhost. Some programs may like one over the other, but they both point to the same location: your computer.

You can imagine localhost as the "name" for the 127.0.0.1 address, much like how "www.google.com" is the "name" for Google's IP address. However, when you visit www.google.com, it has to go through a DNS server so your computer can figure out which IP address matches with the name.

Localhost doesn't need a DNS server, because your computer already knows that it means you want to connect to it. As such, you can use localhost even if you don't have an internet connection.

How to Access 127.0.0.1

If you want to connect to your own computer, you can do so like any other IP address. Open up your web browser and type 127.0.0.1 into the address bar, then press Enter. If you can't remember numbers very well, you can type localhost instead.

If you type this in without any prior setup, you won't find anything exciting. It's likely that your browser will tell you that your computer refused your request.

This sounds a little odd, as your computer basically denied itself from connecting to itself; however, it only did so because it's not expecting any connections at this time. As such, it has no reason to let itself connect to itself, as weird as that sounds!

What Is 127.0.0.1 Used For?

So we have this useful way of telling our PC to connect to itself, but why would we bother in the first place? What practical applications does this have?

Using Localhost to Set Up Networking Tools

While 127.0.0.1 doesn't do much by itself, things change when you run a server on your computer. When you do, your computer now has a reason to listen to incoming connections, so it won't refuse your request.

In fact, it will allow you to access a server hosted on your PC as if you were looking at it via the internet. This is valuable when you're working with networking software and want to ensure everything runs smoothly before putting it on the internet.

For example, let's say you're setting up a server that you want others to connect to in the future. Regardless of if you're using premade software or you're coding the server yourself, you may want to give it a "test run" to ensure it works before letting others connect.

To do this, you can run the server on your computer, then connect to it using 127.0.0.1. The server will load in your browser as if you had connected to it via the internet while also barring anyone else from peeking in on your work-in-progress.

You can see this in action in our guide on how to set up your own WAMP server. In the guide, we talk about how to set up and run a WAMP server on your computer. Once it's running, you can then use "localhost" to see your server in your browser without putting it on the internet.

Using Localhost to Play Games With Friends

You can also use localhost when you're playing multiplayer games. For example, some games allow you to host a server on your PC so friends can play with you. Of course, you want to play along, so you need to connect to the server hosted on your own PC---good thing you have the perfect tool for the job!

Minecraft is one good example where you might use localhost. You can run the server software on your computer to host a world on your PC, but you still need to connect to it via the Minecraft server browser.

To do this, open the server browser and enter "localhost" or "127.0.0.1" as the IP address. Minecraft will recognize this and connect to the server running on your PC.

What's the Difference Between 0.0.0.0 and 127.0.0.1?

Sometimes you'll come across another IP address called 0.0.0.0, which seems to do the same job as 127.0.0.1. However, when you compare them, you'll find that they perform two completely different tasks.

127.0.0.1 is a signal to your computer's TCP/IP that you don't want to connect to the internet; you want to connect to a server on your own computer. As such, you'll typically enter it when telling the software to connect to a server either via a web browser or a game.

0.0.0.0, on the other hand, is more of a wildcard than a specific location. When you use 0.0.0.0, you're telling the software to allow connections from every local IP address possible, instead of just 127.0.0.1.

Getting to Know Your IP Addresses

There are a handful of useful IP addresses that are handy to know, 127.0.0.1 being one of them. Now you know what it does, how it works, and when you can use it.

Are all 127 addresses loopback?

Loopback IP Addresses The IP address range 127.0. 0.0 – 127.255. 255.255 is reserved for loopback, i.e. a Host's self-address, also known as localhost address. This loopback IP address is managed entirely by and within the operating system.

What is IP address 127.0 0.1 typically used for?

Localhost is the default name of the computer you are working on. The term is a pseudo name for 127.0. 0.1, the IP address of the local computer. This IP address allows the machine to connect to and communicate with itself.

Is 127 a valid IP address?

The IP address 127.0. 0.1 is an IPv4 address for a special purpose. It is also known as Localhost or loopback address. Computers employ this address as their own.

What IP address is used as a loopback?

The most commonly used IP address on the loopback network is 127.0. 0.1 for IPv4 and ::1 for IPv6. The standard domain name for the address is localhost . A network device also includes an internal loopback interface ( lo0.