CIDR reference · IPv4

The /31 CIDR block

Two addresses, both usable on point-to-point links (RFC 3021).

/31 · 255.255.255.254 Open in the calculator

2 addresses and, thanks to RFC 3021, both are usable: there is no network or broadcast address on a /31 point-to-point link. Supported by all modern routers and by Linux; some older devices still expect a /30.

Key numbers

Prefix length/31 (31 network bits, 1 host bits)
Subnet mask255.255.255.254
Mask in binary11111111.11111111.11111111.11111110
Wildcard mask0.0.0.1
Total addresses2
Usable hosts2 (RFC 3021 point-to-point)
Fits in a /24128 times
Block sizeIncrements of 2 in octet 4

Example ranges

Private (RFC 1918) blocks of this size. Click one to open it in the calculator.

BlockFirst addressLast addressUsable hosts
10.0.0.0/3110.0.0.010.0.0.110.0.0.0 – 10.0.0.1
172.16.0.0/31172.16.0.0172.16.0.1172.16.0.0 – 172.16.0.1
192.168.0.0/31192.168.0.0192.168.0.1192.168.0.0 – 192.168.0.1

Usable addresses in the cloud

Cloud providers reserve a few addresses in every subnet for the router, DNS and future use, so the usable count is lower than the formula gives.

ProviderUsable in a /31Notes
AWS VPC subnetn/aNot allowed: AWS subnets must be between /16 and /28.
Azure virtual network subnetn/aNot allowed: /29 is the smallest Azure subnet.
Google Cloud subnetn/aNot allowed: /29 is the smallest primary range.

How the numbers are derived

An IPv4 address has 32 bits. A /31 uses 31 of them for the network, leaving 1 host bits, so the block has 21 = 2 addresses. The subnet mask is 31 ones followed by 1 zeros, written in dotted decimal as 255.255.255.254; the wildcard mask 0.0.0.1 is its inverse, used in Cisco ACLs and OSPF configuration.

FAQ

How many hosts can a /31 have?

Two, and both are usable on a point-to-point link under RFC 3021.

How many /31 subnets fit in a /24?

128. A /24 has 256 addresses and a /31 has 2, so 256 ÷ 2 = 128 blocks.