📋 Subnet CIDR Cheat Sheet
A full reference table mapping every CIDR prefix to its subnet mask, wildcard mask and usable host count. Filter by minimum prefix to shorten the table.
How each row is built
All three columns come from one 32-bit mask, made by sliding a solid run of 1 bits left until only the host bits are left as zeros:
mask = 0xFFFFFFFF << (32 - prefix)
wildcard = NOT mask
hosts = 2^(32 - prefix) - 2 for /0 through /30
= 2 for /31 (RFC 3021)
= 1 for /32
The /26 row reads 255.255.255.192, wildcard 0.0.0.63, 62 hosts. Mask and wildcard are exact opposites, so each pair of octets adds to 255 - 192 + 63 is the quickest sanity check there is. The /16 row shows 65,534 hosts, because 16 host bits give 65,536 addresses before the network and broadcast come off.
The two prefixes that break the minus-two rule
- /31 gives 2, not 0. RFC 3021 allows both addresses of a two-address block to be assigned on a point-to-point link, where there is no shared segment for a broadcast to reach. It halves the addresses a router link costs, from four to two.
- /32 gives 1. With no host bits, there is no all-zeros host part to be the network address and no all-ones part to be the broadcast, so nothing is reserved. That is what a loopback interface, a host route or a single-host firewall rule uses.
Frequently asked questions
How many hosts are in a /16?
65,534 usable, out of 65,536 addresses. That is the size of a class B network such as 172.16.0.0/16, and the mask is 255.255.0.0.
Can you use a /31 between two routers?
Yes. RFC 3021 defines exactly that case: both addresses in the /31 become the two interface addresses. Most current routers support it, though a few older platforms still refuse to accept the mask.
What does /32 mean in an IP address?
One single address, with the whole 32 bits fixed. It names a specific host rather than a range, which is why access lists, loopbacks and static host routes are written with it.