CIDR Host Count Calculator
Turn a CIDR prefix like /24 into the numbers that matter — total addresses, usable hosts and the matching subnet mask.
How it works
total = 2^(32 − prefix) · usable = total − 2 (except /31 and /32)
A CIDR prefix says how many leading bits are fixed as the network; the remaining bits address hosts. So the address count is 2 to the power of those host bits, and you subtract two for the network address (all host bits 0) and the broadcast address (all host bits 1) that cannot be assigned to a device. The special cases /31 and /32 skip that subtraction — /31 is a two-address point-to-point link, /32 is a single host.
Worked example
A /26 has 32 − 26 = 6 host bits, so 2⁶ = 64 total addresses. Subtract the network and broadcast and 62 usable host addresses remain, behind the mask 255.255.255.192.
Frequently asked questions
Why subtract 2 from the address count?
The first address in a block identifies the network itself and the last is the broadcast address for it — neither can be handed to a device, so usable hosts are always two fewer than the total, for /30 and larger.
What is a /31 for if it has no usable hosts by the old rule?
RFC 3021 lets a /31 be used on point-to-point links where broadcast is meaningless, giving you both addresses as usable endpoints — handy for router-to-router connections that would otherwise waste a /30.
How does the prefix relate to the subnet mask?
They are the same information in two notations. /24 means 24 one-bits then 8 zero-bits, which written as a dotted quad is 255.255.255.0. Each step in prefix halves or doubles the block size.
Related calculators
This calculator is for educational purposes. Double-check important results before acting on them.