/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.
/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:
| Network | Usable range | Usable 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
- Router-to-router transit links running OSPF or iBGP across a dedicated wire or tunnel.
- Modern replacements for /30 WAN circuits, halving address consumption overnight.
- Conserving public IPv4 space on interconnects where every address counts.
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 this block in a calculator
Open the /31 block in the subnet calculator