CCNA Subnetting Cheat Sheet
Everything you need to subnet fast in the exam: the mask table, the powers of two, the magic-number method, and wildcard masks — with worked examples.
The subnet mask table (memorize this)
This is the single most useful thing to know cold. It covers every subnet inside one octet.
| CIDR | Subnet mask | Block size | Usable hosts | Wildcard |
|---|---|---|---|---|
| /24 | 255.255.255.0 | 256 | 254 | 0.0.0.255 |
| /25 | 255.255.255.128 | 128 | 126 | 0.0.0.127 |
| /26 | 255.255.255.192 | 64 | 62 | 0.0.0.63 |
| /27 | 255.255.255.224 | 32 | 30 | 0.0.0.31 |
| /28 | 255.255.255.240 | 16 | 14 | 0.0.0.15 |
| /29 | 255.255.255.248 | 8 | 6 | 0.0.0.7 |
| /30 | 255.255.255.252 | 4 | 2 | 0.0.0.3 |
| /31 | 255.255.255.254 | 2 | 2* | 0.0.0.1 |
| /32 | 255.255.255.255 | 1 | 1 | 0.0.0.0 |
* A /31 has no network or broadcast address in the usual sense; by RFC 3021 both addresses are usable on point-to-point links. A /32 is a single host route.
Powers of two
Subnetting is just powers of two. Know these forward and backward:
2^1=2 2^2=4 2^3=8 2^4=16
2^5=32 2^6=64 2^7=128 2^8=256
The mask octet values follow the same pattern (add from the left): 128, 192, 224, 240, 248, 252, 254, 255.
The two formulas
- Total addresses in a subnet = 2(host bits), where host bits = 32 − CIDR.
- Usable hosts = 2(host bits) − 2 (one for the network address, one for broadcast).
Example: a /26 has 32 − 26 = 6 host bits → 26 = 64 addresses → 62 usable hosts.
The magic-number method
This is the fastest way to find a subnet's network, broadcast, and host range.
- Find the interesting octet — the one the mask doesn't fill with 255 or 0.
- Magic number = 256 − (mask value in that octet). This is also your block size.
- Count in blocks (0, block, 2×block…) until you pass the IP's value — the subnet starts at the last multiple you didn't pass.
- Broadcast = next subnet − 1. Usable range = network+1 to broadcast−1.
Worked example: 192.168.1.100/26
- Mask = 255.255.255.192 → interesting octet is the 4th.
- Magic number = 256 − 192 = 64 → subnets start at .0, .64, .128, .192.
- .100 falls between .64 and .128 → network = 192.168.1.64.
- Next subnet is .128, so broadcast = 192.168.1.127.
- Usable range = 192.168.1.65 – 192.168.1.126 (62 hosts).
Wildcard masks (for ACLs and OSPF)
A wildcard mask is the inverse of the subnet mask — subtract each octet from 255. The CCNA uses them in access lists and OSPF network statements.
Subnet mask: 255.255.255.192 (/26)
Wildcard: 0. 0. 0. 63
! OSPF example — advertise the 192.168.1.64/26 network
R1(config-router)# network 192.168.1.64 0.0.0.63 area 0
Quick self-check
Try these, then verify with the table above:
- How many usable hosts in a /28? (14)
- What's the block size of a /27? (32)
- Network and broadcast for 10.0.0.200/29? (network 10.0.0.200, broadcast 10.0.0.207)
Drill subnetting until it's automatic
CLI Recall has a subnetting trainer that generates unlimited practice problems and checks your answers instantly — the only way this sticks is reps.
Try the subnetting trainer free