Subnet Mask Cheat Sheet: CIDR, Addresses, and Hosts
Convert common CIDR prefixes to subnet masks, total addresses, and traditional usable-host counts with worked IPv4 examples.
Developer reference
CIDR tells you how many bits belong to the network
IPv4 addresses contain 32 bits. A CIDR prefix such as /24 means the first 24 bits identify the network prefix and the remaining 8 bits are available inside that address block. A longer prefix creates a smaller block.
total addresses = 2^(32 − prefix length)
Common IPv4 subnet mask cheat sheet
| CIDR | Subnet mask | Total addresses | Traditional usable hosts |
|---|---|---|---|
| /20 | 255.255.240.0 | 4,096 | 4,094 |
| /21 | 255.255.248.0 | 2,048 | 2,046 |
| /22 | 255.255.252.0 | 1,024 | 1,022 |
| /23 | 255.255.254.0 | 512 | 510 |
| /24 | 255.255.255.0 | 256 | 254 |
| /25 | 255.255.255.128 | 128 | 126 |
| /26 | 255.255.255.192 | 64 | 62 |
| /27 | 255.255.255.224 | 32 | 30 |
| /28 | 255.255.255.240 | 16 | 14 |
| /29 | 255.255.255.248 | 8 | 6 |
| /30 | 255.255.255.252 | 4 | 2 |
Need the arithmetic and address boundaries for one specific prefix? See the focused walkthrough for calculating usable hosts in a /27 subnet.
Worked example: split a /24 into /26 networks
In the first block, the conventional network address is 192.168.10.0, the broadcast address is 192.168.10.63, and the ordinary host range is 192.168.10.1 through 192.168.10.62.
Why the “minus two” rule has exceptions
The table uses the traditional network-and-broadcast reservation for common IPv4 subnets. RFC 3021 defines /31 prefixes for point-to-point links, where both addresses can identify the two endpoints. A /32 identifies one IPv4 address or host route rather than a multi-address subnet.