/31 subnet (255.255.255.254)
Everything about a /31 network: mask, wildcard, number of hosts, example ranges and when to use it.
| Prefix (CIDR) | /31 |
|---|---|
| Subnet mask | 255.255.255.254 |
| Wildcard mask | 0.0.0.1 |
| Total addresses | 2 |
| Usable hosts | 2 |
| Block size | 2 in the fourth octet |
| Mask in binary | 11111111.11111111.11111111.11111110 |
What is a /31 used for?
Point-to-point links under RFC 3021: both addresses are usable, saving addresses compared with /30. 128 subnets of /31 fit in one /24.
How the numbers are worked out
/31 means the first 31 bits of the address are the network part, leaving 1 bit for hosts. 21 = 2 addresses.
The mask has 31 ones followed by 1 zero. The wildcard mask is the opposite: 255.255.255.255 minus the subnet mask, 0.0.0.1.
Example /31 networks
| Network | Usable range | Broadcast |
|---|---|---|
192.168.1.0/31 | 192.168.1.0 – 192.168.1.1 | — |
192.168.1.2/31 | 192.168.1.2 – 192.168.1.3 | — |
192.168.1.4/31 | 192.168.1.4 – 192.168.1.5 | — |
192.168.1.6/31 | 192.168.1.6 – 192.168.1.7 | — |
Each next /31 network starts 2 addresses after the previous one. Work out any address with the free subnet calculator, or split a network into different sizes with the VLSM planner.
Frequently asked questions
How many hosts are in a /31 subnet?
A /31 has 2 addresses in total and 2 usable hosts. /31 and /32 are special cases with no separate network and broadcast addresses.
What is the subnet mask for /31?
The subnet mask for /31 is 255.255.255.254, and the wildcard mask (used in Cisco ACLs and OSPF) is 0.0.0.1.
What is a /31 subnet used for?
Point-to-point links under RFC 3021: both addresses are usable, saving addresses compared with /30.
Other prefix sizes
Learn more: subnetting in your head, subnetting step by step and the subnetting cheat sheet.