127.0.0.0/8 (Loopback)

Not routableRFC 1122

127.0.0.0/8 at a glance

127.0.0.0/8 at a glance
CIDR block127.0.0.0/8
First address127.0.0.0
Last address127.255.255.255
Total addresses16,777,216
Subnet mask255.0.0.0
Prefix length/8
TypeNot routable
Publicly routableNo
Defined inRFC 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.