Subnet Calculation
You know the theory; now let's learn to calculate at pen-and-paper speed. The whole method rests on one number: block size.
01Step-by-step calculation
Example: 192.168.10.0/26
Step 1 — Find the mask
code
/26 = 26 one-bits, 6 zero-bits
11111111.11111111.11111111.11000000
= 255.255.255.192
Step 2 — Find the block size
code
256 − 192 = 64
Each subnet spans 64 addresses
Step 3 — List the subnets
code
Subnet 1: 192.168.10.0 – .63
Subnet 2: 192.168.10.64 – .127
Subnet 3: 192.168.10.128 – .191
Subnet 4: 192.168.10.192 – .255
02Quick reference table
| CIDR | Mask | Block size | Subnets | Hosts/subnet |
|---|---|---|---|---|
| /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 |
03Practice questions
Solve each one yourself first, then check the worked answer — and verify with the calculator at the end.
Q1: How many hosts fit in 10.0.0.0/8?
code
32 − 8 = 24 host bits
2²⁴ − 2 = 16,777,214 hosts
Q2: What is the broadcast address of 172.16.0.0/12?
code
/12 = first 12 bits are network
Range: 172.16.0.0 – 172.31.255.255
Broadcast: 172.31.255.255
Q3: Which subnet does 192.168.1.130/25 belong to?
code
/25 → block size 128
0–127: first subnet
128–255: second subnet
130 → second subnet: 192.168.1.128/25
04The "which subnet is this IP in?" method
- Find the block size (256 − the mask's last octet)
- Divide the IP's last octet by the block size
- Drop the remainder: the result is the subnet's start
Example: which subnet holds 192.168.1.200/26?
code
Block size = 64
200 ÷ 64 = 3.125 → 3
3 × 64 = 192
Subnet: 192.168.1.192/26
05VLSM (Variable Length Subnet Mask)
Real networks don't give every segment the same size — they cut to fit:
code
Network: 192.168.1.0/24
Department A: needs 100 hosts → /25 (126 hosts)
Department B: needs 50 hosts → /26 (62 hosts)
Department C: needs 20 hosts → /27 (30 hosts)
Router links: need 2 hosts → /30 (2 hosts)
06Summary
- Block size = 256 − the mask's last octet
- Subnet start = the IP rounded down to the nearest multiple of the block size
- Broadcast = the next subnet's start − 1
- VLSM gives every segment exactly as many addresses as it needs