HackMyIP
← back to sheets

What Is the Loopback Address (127.0.0.1 and localhost)?

~/sheets/what-is-loopback.md
1

The Address a Computer Uses to Talk to Itself

2

The loopback address lets a machine send network traffic to itself: packets addressed to it never leave the device and never touch the physical network. The most familiar loopback address is 127.0.0.1, and localhost is the conventional hostname that points to it. Developers rely on it constantly to reach services running on their own machine.

3

If you want to convert an address between formats or check what counts as a normal public IP address type, our IP Converter and HackMyIP home page can help.

4

IPv4 Loopback: the Whole 127.0.0.0/8

5

A common misconception is that only 127.0.0.1 is loopback. In fact the entire 127.0.0.0/8 block is reserved for loopback, which is 16,777,216 (2 to the power of 24) addresses from 127.0.0.0 to 127.255.255.255. RFC 1122 specifies that this range is internal host loopback and must never appear in packets outside the host. 127.0.0.1 is simply the conventional one almost everyone uses, but 127.0.0.2 and the rest of the block loop back just the same.

6

IPv6 Loopback: ::1

7

IPv6 collapses loopback to a single address, ::1 (written in full as 0000:0000:0000:0000:0000:0000:0000:0001, a /128). It is defined in RFC 4291. Do not confuse it with the all-zeros address ::, which is the separate "unspecified" address and is not loopback. You can expand ::1 and see its full form with our IPv6 Expander.

8

localhost vs 127.0.0.1

9

localhost is a name, not an address. It is resolved by your system, usually through the hosts file, and typically maps to 127.0.0.1 and often to ::1 as well. So while localhost and 127.0.0.1 are usually equivalent, they are not identical: on systems that prefer IPv6, localhost may resolve to ::1 first, which occasionally matters when a service is only listening on the IPv4 loopback.

10

Why Developers Use Loopback

11

Loopback is how you connect to a service running on the same computer without involving the network. A local web server on 127.0.0.1:3000, a database, or an API can be reached instantly, in isolation, and privately, since the traffic never leaves the machine. It works even with no internet connection or no network card, which makes it the default way to develop and test software locally.

12

Frequently Asked Questions

13

What is 127.0.0.1?

14

127.0.0.1 is the most common loopback address: traffic sent to it is routed back to the same machine and never leaves the device. It lets a computer connect to services running on itself, such as a local web server or database, without involving the physical network or the internet.

15

What is the difference between localhost and 127.0.0.1?

16

localhost is a hostname, while 127.0.0.1 is the literal IP address. Your system resolves localhost, usually through the hosts file, and it typically maps to 127.0.0.1 and often to the IPv6 loopback ::1. They are usually equivalent, but not identical, since on IPv6-preferring systems localhost may resolve to ::1 first.

17

What is ::1, the IPv6 loopback address?

18

::1 is the IPv6 loopback address, the equivalent of 127.0.0.1 in IPv6, defined in RFC 4291 as a single /128 address. It should not be confused with :: (all zeros), which is the separate unspecified address and is not used for loopback.

19

Why do developers use localhost or 127.0.0.1?

20

To reach services running on their own machine without touching the network. A web server, database, or API listening on 127.0.0.1 can be connected to instantly, in isolation, and privately, because the traffic loops back inside the host. It also works with no internet or network card, which makes it ideal for local development and testing.

21

Is the whole 127.0.0.0/8 range loopback, or just 127.0.0.1?

22

The whole 127.0.0.0/8 block is reserved for loopback, which is about 16.7 million addresses from 127.0.0.0 to 127.255.255.255, per RFC 1122. 127.0.0.1 is just the conventional one almost everyone uses, but every address in the range loops back to the same host.

23
Last updated: April 2026