The host-count formula
Usable hosts per subnet = 2^(32 − prefix) − 2. The −2 removes the network address and the broadcast address.
A /24 = 2^8 − 2 = 254 usable hosts. (Point-to-point /31 links are a special RFC 3021 exception with 2 usable hosts.)
Don't want to do it by hand? Use the interactive subnet calculator — enter an address and prefix to get the mask, network, broadcast and usable range instantly.
Prefix, mask and host count
| CIDR | Subnet mask | Total addr | Usable hosts |
|---|---|---|---|
| /30 | 255.255.255.252 | 4 | 2 |
| /29 | 255.255.255.248 | 8 | 6 |
| /28 | 255.255.255.240 | 16 | 14 |
| /27 | 255.255.255.224 | 32 | 30 |
| /26 | 255.255.255.192 | 64 | 62 |
| /25 | 255.255.255.128 | 128 | 126 |
| /24 | 255.255.255.0 | 256 | 254 |
| /16 | 255.255.0.0 | 65,536 | 65,534 |
| /8 | 255.0.0.0 | 16,777,216 | 16,777,214 |
Private address ranges (RFC 1918)
| Range | CIDR |
|---|---|
| 10.0.0.0 – 10.255.255.255 | 10.0.0.0/8 |
| 172.16.0.0 – 172.31.255.255 | 172.16.0.0/12 |
| 192.168.0.0 – 192.168.255.255 | 192.168.0.0/16 |
Also worth knowing: 127.0.0.0/8 loopback, 169.254.0.0/16 APIPA/link-local.
Exam traps
- Forgetting the −2. Total addresses ≠ usable hosts.
- Mixing up /12 boundaries. 172.16.0.0/12 covers 172.16–172.31, not all of 172.
- Counting a /31 as unusable. RFC 3021 allows 2 hosts on point-to-point links.
Test yourself
4 quick questions — tap an answer to check it instantly. Nothing is sent anywhere.
1. How many usable hosts in a /26?
2. The subnet mask for /24 is…
3. Which is a private (RFC 1918) range?
4. Why subtract 2 from the host count?
Sources
- CompTIA Network+ / Security+ exam objectives.
- Relevant RFCs and vendor documentation.
Reference summary only. For authoritative addressing rules see the relevant RFCs.