127.0.0.0/8 (Loopback)
Not routableRFC 1122
127.0.0.0/8 at a glance
| CIDR block | 127.0.0.0/8 |
|---|---|
| First address | 127.0.0.0 |
| Last address | 127.255.255.255 |
| Total addresses | 16,777,216 |
| Subnet mask | 255.0.0.0 |
| Prefix length | /8 |
| Type | Not routable |
| Publicly routable | No |
| Defined in | RFC 1122 |
Open in CIDR calculator/8 subnet details
What is 127.0.0.0/8 used for?
127.0.0.0/8 is reserved for loopback: traffic to any of these addresses never leaves the host. 127.0.0.1 (localhost) is the address almost everyone uses, but the whole /8 is loopback on Linux. These addresses must never appear on a network.
Common subnets of 127.0.0.0/8
FAQ
Is 127.0.0.1 the same as localhost?
Usually. localhost resolves to 127.0.0.1 (and ::1 for IPv6) through the hosts file, but it is a name, while 127.0.0.1 is the address.
Can I use 127.0.0.2 or other 127.x.x.x addresses?
Yes, on Linux the whole 127.0.0.0/8 is loopback, so 127.0.0.2 works without configuration. macOS only configures 127.0.0.1 by default; add others with ifconfig lo0 alias.