How to Use This Tool
A CIDR prefix is nothing more than a count of leading 1 bits in a 32-bit mask. Everything else — the subnet mask, the wildcard, the host count — falls out of that single number, which is why this page needs only one input.
Netmask and wildcard
The subnet mask writes those 1 bits as four decimal octets. A /26 is twenty-six 1s
followed by six 0s, which is 255.255.255.192.
The wildcard mask is the same thing inverted: every bit flipped, or equivalently
255 minus each octet. For /26 that is 0.0.0.63. Cisco ACLs and OSPF network
statements want the wildcard, not the netmask, and quietly matching the wrong range is one of the most
common configuration errors in networking. A 1 in a wildcard means “ignore this bit”.
Host counts, and where the formula breaks
A prefix of length n leaves 32 − n host bits, giving 232−n addresses. Two of them are normally unusable: the all-zeros host portion is the network address, and the all-ones portion is the broadcast address. So usable hosts = 232−n − 2.
That subtraction fails at the two smallest prefixes, and this is where quick mental arithmetic and many online calculators go wrong.
Prefixes worth memorising
- /24 — 256 addresses, 254 hosts, mask 255.255.255.0. The default mental unit.
- /30 — 4 addresses, 2 hosts. The traditional point-to-point link.
- /31 — 2 addresses, both usable. The modern point-to-point link; halves the waste.
- /32 — one address. Host routes, loopbacks and firewall rules for a single machine.
- /16 and /8 — 65,536 and 16,777,216 addresses, the old class B and class A boundaries.
A note on the wildcard
The reason ACLs use wildcards rather than netmasks is historical, but the practical consequence is real:
a wildcard need not be contiguous. 0.0.0.255 matches a whole /24, while
0.0.0.1 matches only every other address. The values on this page are the contiguous ones that
correspond to real prefixes; anything else is legal in an ACL and will not be a valid subnet mask.
