Concept
Use the prefix as the source of truth. Traditional usable-host counts subtract two only for ordinary subnets; /31 and /32 require special handling.
IPv4 CIDR reference
| CIDR | Mask | Wildcard | Total addresses | Traditional usable hosts |
|---|---|---|---|---|
| /16 | 255.255.0.0 | 0.0.255.255 | 65,536 | 65,534 |
| /20 | 255.255.240.0 | 0.0.15.255 | 4,096 | 4,094 |
| /21 | 255.255.248.0 | 0.0.7.255 | 2,048 | 2,046 |
| /22 | 255.255.252.0 | 0.0.3.255 | 1,024 | 1,022 |
| /23 | 255.255.254.0 | 0.0.1.255 | 512 | 510 |
| /24 | 255.255.255.0 | 0.0.0.255 | 256 | 254 |
| /25 | 255.255.255.128 | 0.0.0.127 | 128 | 126 |
| /26 | 255.255.255.192 | 0.0.0.63 | 64 | 62 |
| /27 | 255.255.255.224 | 0.0.0.31 | 32 | 30 |
| /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 | Point-to-point convention |
| /32 | 255.255.255.255 | 0.0.0.0 | 1 | Host route |
IPv6 planning boundaries
/32, /48, /56, /60, and /64 are common planning boundaries. They are conventions and allocation practices, not a replacement for the prefix requirements of a particular design.
Worked example
192.168.1.77/26
256 - 192 = 64
Boundaries: 0, 64, 128, 192
77 is between 64 and 127
Network: 192.168.1.64/26Try it yourself
Use the subnet calculator and open Show Me the Math to see the calculation for your own address.