Toolman

/31 subnet

A /31 has a subnet mask of 255.255.255.254 and 2 usable hosts.

The numbers

Prefix length/31
Subnet mask255.255.255.254
Wildcard mask0.0.0.1
Network bits31
Host bits1
Total addresses2
Usable hosts2
/24 networks contained

Where a /31 is used

Two addresses, both usable. Under the ordinary rule a /31 would have no assignable hosts at all; RFC 3021 makes an exception for point-to-point links, where a broadcast address serves no purpose. It halves the waste of using a /30.

Why the usable count is what it is

Following the ordinary rule, a /31 would have two addresses and lose both to the network and broadcast, leaving nothing. RFC 3021 recognises that a point-to-point link has exactly two endpoints and no need to broadcast, so on such a link both addresses are assignable. This is why modern router configurations use /31 where older ones used /30.

Binary layout

mask   11111111.11111111.11111111.11111110
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 
       31 network bits, 1 host bits

Splitting and combining

PrefixUsable hostsRelationship
Twice the size/302Two /31 networks combine into one /30
This network/312
Half the size/321One /31 splits into two /32 networks

Frequently asked questions

How many hosts are in a /31?

2 addresses in total, of which 2 are usable. Both are usable because RFC 3021 removes the broadcast address on point-to-point links.

What is the subnet mask for /31?

255.255.255.254. The prefix length is the count of leading 1 bits in the mask, so /31 is 31 ones followed by 1 zero.

What is the wildcard mask for /31?

0.0.0.1 — the bitwise inverse of the subnet mask. Cisco access lists and OSPF network statements take the wildcard rather than the mask; a zero bit must match and a one bit is ignored.

How does a /31 compare to a /24?

A /31 is smaller: 128 of them fit inside one /24.

Other prefix lengths

All prefix lengths · Subnet calculator