Subnetting in Minutes: The Cheatsheet That Sticks
One trick — the block size — answers 95% of subnet questions. Masks, ranges, host counts, and design, in one page you'll actually use.
The only trick you need
Every IPv4 subnet question reduces to one number: the block size in the "interesting" octet (the last octet that isn't all 1s or all 0s in the mask):
Example: 192.168.7.129/26. Mask = 255.255.255.192; interesting octet is the 4th: 256 − 192 = 64. Boundaries: 0, 64, 128, 192, 256. Address 129 sits in the 192.168.7.128/26 network; broadcast is one before the next boundary: 192.168.7.191; usable hosts run .129–.190 (62 hosts).
The table to memorize
| /CIDR | Mask | Block | /24 splits | Usable hosts |
|---|---|---|---|---|
| /24 | 255.255.255.0 | 256 | 1 | 254 |
| /25 | 255.255.255.128 | 128 | 2 | 126 |
| /26 | 255.255.255.192 | 64 | 4 | 62 |
| /27 | 255.255.255.224 | 32 | 8 | 30 |
| /28 | 255.255.255.240 | 16 | 16 | 14 |
| /29 | 255.255.255.248 | 8 | 32 | 6 |
| /30 | 255.255.255.252 | 4 | 64 | 2 |
| /31 | 255.255.255.254 | 2 | 128 | 2* |
| /32 | 255.255.255.255 | 1 | 256 | 1* |
Handy larger masks: /23 = 255.255.254.0 (512 addresses), /22 = 255.255.252.0 (1,024), /20 = 255.255.240.0 (4,096), /16 = 255.255.0.0 (65,536).
Designing subnets (VLSM)
Say you get 10.20.0.0/16 and need networks of 200, 60, 12, and a few point-to-point links:
- Host bits: 2n − 2 ≥ needed hosts → 200 hosts need 8 bits (254 usable), 60 need 6 bits (62), 12 need 4 bits (14), links need /31 (2 usable) or /30.
- Order largest first: allocate the /24, then /26, then /28, then /31s. Largest-first is what prevents the "puzzle pieces don't fit" problem.
- Walk the boundaries: 10.20.0.0/24, then 10.20.1.0/26, 10.20.1.64/26 is free… the next is 10.20.1.128 — but you only need a /26 for 60: 10.20.1.0/26, /28 at 10.20.1.64/28, and /31s at 10.20.1.80/31, .82/31, …
Worked example: the third octet
10.14.23.44/20. Mask: 255.255.240.0; interesting octet = 3rd: block = 256 − 240 = 16. Boundaries: 16, 32 — 23 falls in the 10.14.16.0/20 network. Broadcast: 10.14.31.255. Usable: 10.14.16.1 – 10.14.31.254 (4,094 hosts).
- Block size = 256 − (mask octet). Subnets step by the block size in the interesting octet.
- /31 gets 2 usable hosts (RFC 3021); /32 is a single host route.
- When designing: borrow bits with 2ⁿ ≥ subnets needed; size hosts first, then subnets.
- Practice with the free subnet calculator and quiz until it's automatic.