IPv4 Address Count from CIDR Prefix
Count the addresses in an IPv4 CIDR block using any prefix from /0 through /32. The total includes every address in the block.
Formula & assumptions
Addresses = 2^(32 − prefix length).
The count includes every address in the block. The portion available to hosts depends on the network configuration.
Worked example
- Prefix length
- 24
- Total addresses
- 256
Interpreting the result
Increasing the prefix length by one halves the address count, so two consecutive, correctly aligned /25 blocks make one /24.