/31 Subnet Mask — 255.255.255.254
Everything about the /31 prefix: the subnet mask 255.255.255.254, wildcard mask 0.0.0.1, its two assignable addresses under RFC 3021, and how the block is laid out in practice.
Complete CIDR reference table
Every valid IPv4 prefix from /0 to /32 with its mask, wildcard and address counts.
| Prefix | Subnet mask | Wildcard | Total addresses | Usable hosts | Block size |
|---|---|---|---|---|---|
| /0 | 0.0.0.0 | 255.255.255.255 | 4,294,967,296 | 4,294,967,294 | 4,294,967,296 |
| /1 | 128.0.0.0 | 127.255.255.255 | 2,147,483,648 | 2,147,483,646 | 2,147,483,648 |
| /2 | 192.0.0.0 | 63.255.255.255 | 1,073,741,824 | 1,073,741,822 | 1,073,741,824 |
| /3 | 224.0.0.0 | 31.255.255.255 | 536,870,912 | 536,870,910 | 536,870,912 |
| /4 | 240.0.0.0 | 15.255.255.255 | 268,435,456 | 268,435,454 | 268,435,456 |
| /5 | 248.0.0.0 | 7.255.255.255 | 134,217,728 | 134,217,726 | 134,217,728 |
| /6 | 252.0.0.0 | 3.255.255.255 | 67,108,864 | 67,108,862 | 67,108,864 |
| /7 | 254.0.0.0 | 1.255.255.255 | 33,554,432 | 33,554,430 | 33,554,432 |
| /8 | 255.0.0.0 | 0.255.255.255 | 16,777,216 | 16,777,214 | 16,777,216 |
| /9 | 255.128.0.0 | 0.127.255.255 | 8,388,608 | 8,388,606 | 8,388,608 |
| /10 | 255.192.0.0 | 0.63.255.255 | 4,194,304 | 4,194,302 | 4,194,304 |
| /11 | 255.224.0.0 | 0.31.255.255 | 2,097,152 | 2,097,150 | 2,097,152 |
| /12 | 255.240.0.0 | 0.15.255.255 | 1,048,576 | 1,048,574 | 1,048,576 |
| /13 | 255.248.0.0 | 0.7.255.255 | 524,288 | 524,286 | 524,288 |
| /14 | 255.252.0.0 | 0.3.255.255 | 262,144 | 262,142 | 262,144 |
| /15 | 255.254.0.0 | 0.1.255.255 | 131,072 | 131,070 | 131,072 |
| /16 | 255.255.0.0 | 0.0.255.255 | 65,536 | 65,534 | 65,536 |
| /17 | 255.255.128.0 | 0.0.127.255 | 32,768 | 32,766 | 32,768 |
| /18 | 255.255.192.0 | 0.0.63.255 | 16,384 | 16,382 | 16,384 |
| /19 | 255.255.224.0 | 0.0.31.255 | 8,192 | 8,190 | 8,192 |
| /20 | 255.255.240.0 | 0.0.15.255 | 4,096 | 4,094 | 4,096 |
| /21 | 255.255.248.0 | 0.0.7.255 | 2,048 | 2,046 | 2,048 |
| /22 | 255.255.252.0 | 0.0.3.255 | 1,024 | 1,022 | 1,024 |
| /23 | 255.255.254.0 | 0.0.1.255 | 512 | 510 | 512 |
| /24 | 255.255.255.0 | 0.0.0.255 | 256 | 254 | 256 |
| /25 | 255.255.255.128 | 0.0.0.127 | 128 | 126 | 128 |
| /26 | 255.255.255.192 | 0.0.0.63 | 64 | 62 | 64 |
| /27 | 255.255.255.224 | 0.0.0.31 | 32 | 30 | 32 |
| /28 | 255.255.255.240 | 0.0.0.15 | 16 | 14 | 16 |
| /29 | 255.255.255.248 | 0.0.0.7 | 8 | 6 | 8 |
| /30 | 255.255.255.252 | 0.0.0.3 | 4 | 2 | 4 |
| /31 | 255.255.255.254 | 0.0.0.1 | 2 | 2 (RFC 3021) | 2 |
| /32 | 255.255.255.255 | 0.0.0.0 | 1 | 1 | 1 |
Quick reference: mask to prefix
Reading a mask written in dotted-decimal form. Count the 1 bits, or use the octet boundaries below.
| Subnet mask | Prefix | Wildcard | Usable hosts | Block size |
|---|---|---|---|---|
| 255.255.255.128 | /25 | 0.0.0.128 | 126 | 128 |
| 255.255.255.192 | /26 | 0.0.0.64 | 62 | 64 |
| 255.255.255.224 | /27 | 0.0.0.32 | 30 | 32 |
| 255.255.255.240 | /28 | 0.0.0.16 | 14 | 16 |
| 255.255.255.248 | /29 | 0.0.0.8 | 6 | 8 |
| 255.255.255.252 | /30 | 0.0.0.4 | 2 | 4 |
| 255.255.255.254 | /31 | 0.0.0.2 | 0 | 2 |
| 255.255.255.255 | /32 | 0.0.0.1 | 0 | 1 |
Example: 255.255.255.224 has three 1 bits in its last octet, so the prefix is 24 + 3 = /27, the wildcard is 0.0.0.31 and there are 32 addresses of which 30 are usable.
What a /31 means
The number after the slash counts the network bits, so a /31 has 31 network bits and 1 host bit. Those 1 bits are what produce the address count: 2^1 = 2 addresses in the block.
Prefix /31 Subnet mask 255.255.255.254 Wildcard 0.0.0.1 Binary mask 11111111.11111111.11111111.11111110 Host bits 1
RFC 3021 point-to-point link with no broadcast address, 2 addresses.
A worked /31 block
Taking 192.168.1.0 as the starting point and applying the /31 mask gives the boundaries below. The network address is the base with every host bit cleared, and the broadcast address is the base with every host bit set — which is why they are always the first and last addresses in the block.
192.168.1.0/31
Network address 192.168.1.0
First address 192.168.1.0
Second address 192.168.1.1
—
Total addresses 2
RFC 3021 redefines a /31 as a point-to-point link with no network or broadcast address, so both addresses are assignable. That is a real saving on router-to-router links: a /31 wastes nothing, while the older /30 convention wastes two of its four addresses.
Sizing a /31
To decide whether a /31 fits a requirement, compare the address count against the number of devices you need to address, then add spare capacity.
| Measure | Value | What it means |
|---|---|---|
| Network bits | 31 | Fixed portion identifying the subnet |
| Host bits | 1 | Bits available for device addresses |
| Total addresses | 2 | The size of the block |
| Usable hosts | 2 | No network or broadcast address is reserved |
| Block size | 2 | Spacing between consecutive subnets |
Common mistakes
- Writing the mask wrong. There is exactly one valid mask for a /31: 255.255.255.254. Anything else is a different prefix and will silently create a different network.
- Using the wildcard as the mask. 0.0.0.1 is the wildcard for a /31, not the mask. In a Cisco ACL the wildcard convention is inverted, so the two get swapped constantly.
- Starting the subnet off its boundary. A /31 must start on a multiple of 2. Starting anywhere else overlaps neighbouring subnets and produces routing loops or unreachable ranges.
- Assuming a /31 is the right size for every case. Check the host requirement first — the CIDR calculator has a host-to-prefix cheat sheet, and the subnet calculator shows the full breakdown for any address.
Other prefixes
Jump to another prefix, or see the complete table with all 33 values.
Neighbouring prefixes compared
| Prefix | Mask | Hosts | Block size | Relationship |
|---|---|---|---|---|
| /29 | 255.255.255.248 | 6 | 8 | A further halving or doubling |
| /30 | 255.255.255.252 | 2 | 4 | Half the hosts — one bit borrowed |
| /31 | 255.255.255.254 | 2 | 2 | This page |
| /32 | 255.255.255.255 | 1 | 1 | Double the hosts — one bit returned |
Every step to a shorter prefix doubles the address count, and every step to a longer prefix halves it. That single rule explains the whole table.
Related: CIDR calculator, subnet calculator, VLSM planner, CIDR notation explained, subnetting guide.
IP to Binary Converter · Binary to IP Converter · IP to Hex Converter · Hex to IP Converter · IP to Decimal Converter ·
Frequently asked questions
What is the subnet mask for a /31?
The subnet mask for a /31 is 255.255.255.254. It is 31 consecutive 1 bits followed by 1 0 bits, which is what makes the host portion of the address 1 bits wide. The corresponding wildcard mask is 0.0.0.1, which is the bitwise inverse and is what you would use in a Cisco ACL or an OSPF network statement.
How many addresses are in a /31?
A /31 contains 2^1 = 2 addresses. That follows directly from the host bit count: a /31 leaves 1 bits for the host portion, and each bit doubles the count. Every step to a longer prefix halves this number, and every step to a shorter prefix doubles it.
How many usable hosts does a /31 have?
Two, under RFC 3021. Normally a subnet reserves its first address as the network address and its last as the broadcast address, which would leave a /31 with nothing. RFC 3021 removes that reservation for point-to-point links so both addresses can be assigned, which is why modern router-to-router links use /31 instead of /30.
What is the block size of a /31?
The block size is 2, the same as the address count. Consecutive /31 subnets therefore start every 2 addresses. A /31 that does not begin on a multiple of 2 overlaps its neighbours, which causes addresses to be unreachable or routed to the wrong place.
How do I split a /31 into smaller subnets?
A /31 is already at or near the smallest practical size. It cannot be divided further without producing subnets that have no usable host addresses, so if you need more segments you should start from a shorter prefix.
Is a /31 a private or public subnet?
The prefix length says nothing about whether an address is private or public — that is determined by the address range, not the mask. A 192.168.1.0/24 is private because it sits inside the RFC 1918 block 192.168.0.0/16, while 203.0.113.0/24 is documentation space and 8.8.8.0/24 is public. Use the subnet calculator with any address in the block to see its classification.