/31 Subnet Mask ReferenceIPv4

Two addresses, both usable: the /31 turns the old WAN-link tax into a rounding error. RFC 3021 blessed this format for point-to-point links, and every modern routing platform speaks it fluently.

The /31 subnet mask is 255.255.255.254, equivalent to 0.0.0.1 as a wildcard. A /31 block contains 2 IP addresses (2 usable hosts, both usable on a point-to-point link).

/31 facts at a glance

Subnet mask
255.255.255.254
Wildcard mask
0.0.0.1
Binary mask
11111111.11111111.11111111.11111110
Total addresses
2
Usable hosts
2 (point-to-point per RFC 3021)
Block size
2 addresses (21)
Typical role
Point-to-point links (RFC 3021)

Example /31 networks

Three consecutive /31 blocks, starting at the /31 boundary that contains 198.51.100.0:

NetworkUsable rangeUsable hosts
198.51.100.0/31 198.51.100.0 2
198.51.100.2/31 198.51.100.2 2
198.51.100.4/31 198.51.100.4 2

How to calculate a /31 mask

A /31 mask sets the first 31 bits of a 32-bit number to 1 and leaves the remaining 1 bits as 0. In binary that reads 11111111.11111111.11111111.11111110, which converts to dotted decimal 255.255.255.254. Each block covers a contiguous run of 21 = 2 addresses, and every block starts at a multiple of that size. The wildcard simply flips every bit, giving 0.0.0.1.

Where /31 is used

RFC 3021 removes the network/broadcast requirement for /31s on point-to-point links, so both addresses become ordinary interface addresses.

Only two-device links qualify. Anything with more speakers, such as shared Ethernet or Wi-Fi, still needs /30 or wider.

Frequently asked questions

Is /31 valid on Ethernet?

Yes, when exactly two devices share the segment. RFC 3021 defines /31 behavior specifically for point-to-point links, and Ethernet between two routers qualifies.

How many usable hosts are in a /31?

Both of them. Unlike every other prefix below /31, there is no deduction: two total addresses, two usable.

What is the subnet mask for a /31?

<code>255.255.255.254</code>, wildcard <code>0.0.0.1</code>: a single host bit distinguishes the two endpoints.

Do routing protocols work over /31 links?

OSPF and BGP sessions over /31 transit links are standard practice on current router and firewall platforms.

Open the /31 block in the subnet calculator

Get the /31 wildcard mask →

Related prefixes

/24/26/28/30/32