1. What a /31 network is
The /31 in a CIDR block is the prefix length: how many
leading bits identify the network. Those 31 bits are identical for every address in the
block, and the remaining 1 host bits are free to vary. Written out as
a mask that is 31 ones followed by 1 zeros, which in dotted decimal is
255.255.255.254.
prefix /31
mask 255.255.255.254
binary 11111111.11111111.11111111.11111110
wildcard 0.0.0.11 host bits give 21 = 2 addresses. Both of those addresses are usable. RFC 3021 removes the network and broadcast addresses for this one prefix length, precisely so that a router-to-router link does not need four addresses to carry two.
| Property | Value |
|---|---|
| CIDR notation | /31 |
| Subnet mask | 255.255.255.254 |
| Wildcard mask | 0.0.0.1 |
| Host bits | 1 |
| Total addresses | 2 |
| Usable hosts | 2 |
The wildcard mask is the bitwise inverse of the subnet mask — 0.0.0.1 here —
and it is what Cisco access lists and OSPF network statements expect instead of a
netmask. A zero bit in a wildcard means “this bit must match”, which is the opposite convention
to a netmask, and mixing the two up is one of the most common configuration errors in the
subject. In classful terms a /31 is longer than a class C default mask — a subnetted class C in classful terms.
2. The 192.168.1.2/31 block, address by address
A worked example is easier to check than a formula. 192.168.1.2/31 is a real
/31 inside a private range, and every figure below follows from the mask alone:
| Address | Value | What it is |
|---|---|---|
| Network | 192.168.1.2 | The block itself; not assigned to a host |
| Host range | 192.168.1.2 – 192.168.1.3 | 2 hosts you can assign |
| Broadcast | — | Removed on a /31 by RFC 3021 |
| Subnet mask | 255.255.255.254 | Which bits are the network |
| Wildcard | 0.0.0.1 | The inverse, for ACLs |
network 11000000.10101000.00000001.00000010
mask 11111111.11111111.11111111.11111110
Line the two up and the rule is visible: wherever the mask has a 1, the network bit is fixed;
wherever it has a 0, the address is free to count up. Entering either address gives the same block: 192.168.1.3/31 and 192.168.1.2/31 describe the same link, because the single host bit is masked away.
3. How many /31 networks fit inside a bigger block
Prefix arithmetic is powers of two all the way down: each extra bit of prefix halves the block. Going the other way, the number of /31 networks inside a shorter prefix is two to the power of the difference between the two prefix lengths, which is where these counts come from.
| One block of | Contains | Usable hosts in total |
|---|---|---|
| 1 × /8 | 8,388,608 × /31 | 16,777,216 |
| 1 × /12 | 524,288 × /31 | 1,048,576 |
| 1 × /16 | 32,768 × /31 | 65,536 |
| 1 × /20 | 2,048 × /31 | 4,096 |
| 1 × /24 | 128 × /31 | 256 |
The usable-host column is the one worth noticing. Every split costs two addresses per subnet to the network and broadcast addresses, so a plan built from many small subnets always has fewer usable addresses than the block it came from — dividing one /24 into eight /27s leaves 240 usable addresses where the /24 had 254. That is the real price of a subnetting plan, and it is why router-to-router links in a modern design get /31s rather than /30s.
4. Splitting a /31
Borrowing host bits turns one block into several equal ones. Each bit borrowed doubles the number of subnets and halves their size:
| Split into | Mask | How many | Usable hosts each |
|---|---|---|---|
| /32 | 255.255.255.255 | 2 | 1 |
The console at the top of this page does this for you: set the CIDR to a /31 and choose a longer prefix under Split into to get the resulting networks with their ranges. It caps how many rows it draws — splitting a /8 into /24s is 65,536 subnets — but the count it reports is always the true total.
5. Where a /31 is used
A two-address point-to-point link with no network or broadcast address, permitted by RFC 3021. Preferred over a /30 on router-to-router links because it wastes nothing.
A prefix length says nothing about whether the addresses are private. That is decided by the
address itself: 10.0.0.0/8, 172.16.0.0/12 and
192.168.0.0/16 are the RFC 1918 private ranges, 100.64.0.0/10 is
carrier-grade NAT space from RFC 6598, 169.254.0.0/16 is link-local, and
127.0.0.0/8 is loopback. A /31 carved out of any of them is private; the same
/31 out of a public allocation is globally routable. The console labels which range an
address falls into, including the documentation blocks from RFC 5737 that turn up in tutorials.
IPv6 changes the habit rather than the arithmetic. The mask still marks the network bits, but
subnets are conventionally /64 regardless of how many hosts are on them — SLAAC
needs 64 host bits — and a site is normally delegated a /48 or /56.
There is no broadcast address to subtract, so the “minus two” rule has no IPv6 equivalent. The
console handles IPv6 blocks as well; switch the address family above.
6. CIDR to subnet mask, around /31
The neighbouring prefixes, for when the question is really “which one do I need?” — each row is a page of its own with the same worked detail:
| Prefix | Subnet mask | Wildcard | Addresses | Usable hosts |
|---|---|---|---|---|
| /28 | 255.255.255.240 | 0.0.0.15 | 16 | 14 |
| /29 | 255.255.255.248 | 0.0.0.7 | 8 | 6 |
| /30 | 255.255.255.252 | 0.0.0.3 | 4 | 2 |
| /31 | 255.255.255.254 | 0.0.0.1 | 2 | 2 |
| /32 | 255.255.255.255 | 0.0.0.0 | 1 | 1 |
The subnet calculator carries the full /8 to /32 chart, and works the question backwards too: give it a host count and it returns the shortest prefix that fits, which is the calculation a design actually starts from.
7. /31 Subnet FAQs
What is the subnet mask for a /31?
255.255.255.254. In binary that is 11111111.11111111.11111111.11111110 — 31 network bits followed by 1 host bits. The wildcard mask, which Cisco access lists and OSPF network statements use instead of a netmask, is the bitwise inverse: 0.0.0.1.
How many hosts are in a /31?
Two, and both are usable. RFC 3021 allows a /31 to be used for point-to-point links with no network or broadcast address, which is why it carries two hosts rather than the zero a blanket minus-two rule would give.
How many /31 networks fit in a /24?
128. Each extra bit of prefix halves the block, so the count is two to the power of the difference in prefix length — 31 minus 24 is 7 bits, giving 128 separate /31 networks with 2 usable hosts each.
What is the address range of 192.168.1.2/31?
192.168.1.2 to 192.168.1.3, which is 2 addresses. Both addresses, 192.168.1.2 and 192.168.1.3, are assignable to an interface.
Why is a /31 not simply the address count minus two?
It does not apply at this prefix length. A /31 has no network or broadcast address: RFC 3021 defines a /31 as a two-address point-to-point link and a /32 as a single host. Subtracting two would give zero or minus one, which is why calculators that apply the rule blindly report nonsense here.
How do I split a /31 into smaller subnets?
Borrow host bits. Moving from /31 to /32 gives two equal subnets, /33 gives four, and so on — each bit doubles the count and halves the size. Enter the block above and set “Split into /” to the longer prefix to list every resulting subnet with its range and host count.
Does a /31 mean the addresses are private?
No. The prefix length says how big the block is, not who can route to it. Private addressing comes from the ranges themselves: 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16 under RFC 1918, plus 100.64.0.0/10 for carrier-grade NAT and 169.254.0.0/16 for link-local. The same prefix length out of a public allocation is globally routable.
Is the address I enter sent to a server?
No. Addresses are parsed and masked in your browser as 32-bit integers, or as BigInt values for IPv6. No DNS query is made, nothing is resolved, nothing is logged or stored, and the page works offline once it has loaded.