How CIDR notation works
An IPv4 address is 32 bits. The number after the slash says how many of those bits name the network; the rest number the hosts inside it. A /24 leaves 8 host bits, so it holds 2⁸ = 256 addresses. Every step down halves the block: a /25 holds 128, a /26 holds 64.
In a normal subnet the first address is the network itself and the last is the broadcast address, so neither can be given to a server. That is why a /24 has 254 usable hosts, not 256. Two exceptions: a /31 is a point-to-point link where both addresses are usable (RFC 3021), and a /32 is a single host.
IPv6 has no broadcast address, and subnets are far larger. The usual size for one network is a /64; providers commonly hand customers a /56 or /48.
| Prefix | Addresses (usable) |
|---|---|
| /32 | 1 (1) |
| /31 | 2 (2, point-to-point) |
| /30 | 4 (2) |
| /29 | 8 (6) |
| /28 | 16 (14) |
| /27 | 32 (30) |
| /26 | 64 (62) |
| /25 | 128 (126) |
| /24 | 256 (254) |
| /22 | 1,024 (1,022) |
| /20 | 4,096 (4,094) |
| /16 | 65,536 (65,534) |