Subnetting scares people because it looks like math. It's really just memorizing one short table and knowing two shortcuts. Here's the whole thing.
CIDR prefix → mask → hosts
| CIDR | Subnet mask | Usable hosts |
|---|---|---|
/24 | 255.255.255.0 | 254 |
/25 | 255.255.255.128 | 126 |
/26 | 255.255.255.192 | 62 |
/27 | 255.255.255.224 | 30 |
/28 | 255.255.255.240 | 14 |
/29 | 255.255.255.248 | 6 |
/30 | 255.255.255.252 | 2 |
/30 gives 2 usable — exactly right for a point-to-point link.The "magic number" method
To subnet in your head, work in the interesting octet — the one where the mask isn't 0 or 255:
- Find the mask value in that octet (e.g.
/26→ 192). - Subtract from 256:
256 − 192 = 64. That's your block size. - Subnets start at multiples of 64:
.0, .64, .128, .192. - The broadcast of each is one below the next start:
.63, .127, .191, .255.
That single trick answers "what subnet is this host in?" and "what's the broadcast?" without long division.
Powers of two worth memorizing
| Bits | Value |
|---|---|
2^1 … 2^8 | 2, 4, 8, 16, 32, 64, 128, 256 |
Those eight numbers are the entire secret. Mask octets are always one of them subtracted from 256, and host counts are always a power of two minus 2.
Practice until it's automatic
The Subnetting & CIDR Cheat Sheet + Practice Problems pairs this reference with worked examples and drills — the fastest way to make subnetting reflexive before an exam or interview. Instant download.
Get the sheet + practice →