Counting Hosts in a Subnet
Calculate how many usable addresses a subnet provides.
Hosts Come From Host Bits
The number of addresses in a subnet depends entirely on the host bits — the 0 bits in the mask. The more host bits, the more addresses.
If you know the prefix, you know the host bits: subtract the prefix from 32. A /24 has 32 minus 24 = 8 host bits.
The Power of Two Formula
The total number of addresses in a subnet is 2 to the power of the host bits. With 8 host bits, that is 2^8 = 256 total addresses.
This count includes every possible combination of host bits, from all zeros to all ones — including the special network and broadcast addresses.
total = 2 ^ (32 - prefix)
/24 -> 2 ^ 8 = 256All lessons in this course
- What a Subnet Mask Does
- Reading CIDR Slash Notation
- Counting Hosts in a Subnet
- Splitting a Network Into Subnets