What you need
The number of devices per network segment, the address block you are allowed to use (in a private network, usually part of 10.0.0.0/8, 172.16.0.0/12 or 192.168.0.0/16) and an idea of how much each group will grow. The examples below use the documentation block 198.51.100.0/24.
Reading the result
A subnet with prefix length p has 2^(32 − p) addresses. Two of them, the network and broadcast addresses, are reserved, so the usable count is 2^(32 − p) − 2. Pick the largest prefix (the smallest subnet) whose usable count still covers your total:
| Prefix | Mask | Addresses | Usable hosts |
|---|---|---|---|
| /22 | 255.255.252.0 | 1024 | 1022 |
| /23 | 255.255.254.0 | 512 | 510 |
| /24 | 255.255.255.0 | 256 | 254 |
| /25 | 255.255.255.128 | 128 | 126 |
| /26 | 255.255.255.192 | 64 | 62 |
| /27 | 255.255.255.224 | 32 | 30 |
| /28 | 255.255.255.240 | 16 | 14 |
| /29 | 255.255.255.248 | 8 | 6 |
| /30 | 255.255.255.252 | 4 | 2 |
So 60 devices need a /26, 90 or 100 need a /25, and 127 already need a /24.
Now split 198.51.100.0/24 between five groups. The VLSM planner places the largest block first so every block stays aligned:
| Subnet | Hosts needed | Block | Usable range | Broadcast | Spare |
|---|---|---|---|---|---|
| Staff | 100 | 198.51.100.0/25 | .1 – .126 | .127 | 26 |
| Guest Wi-Fi | 50 | 198.51.100.128/26 | .129 – .190 | .191 | 12 |
| Servers | 20 | 198.51.100.192/27 | .193 – .222 | .223 | 10 |
| Printers | 10 | 198.51.100.224/28 | .225 – .238 | .239 | 4 |
| Router link | 2 | 198.51.100.240/30 | .241 – .242 | .243 | 0 |
The plan uses 244 of the 256 addresses and leaves 12 free (198.51.100.244 to .255). The Staff network's mask is 255.255.255.128 and its wildcard mask, used in many access lists, is 0.0.0.127.
Common pitfalls
- Forgetting the two reserved addresses. 64 devices do not fit in a /26: it has 64 addresses but only 62 usable.
- Sizing for today only. A subnet with zero spare addresses means renumbering later. The Router link above is fine at zero spare because a point-to-point link never grows.
- Starting a subnet in the wrong place. A block must start on a multiple of its size: a /26 can start at .0, .64, .128 or .192, never at .100. The calculators always return the aligned network address.
- Mixing /30 and /31. For two hosts the Subnet Calculator suggests a /31, which RFC 3021 allows on point-to-point links; the VLSM planner uses the classic /30. Use /31 only where both devices support it.
- Mismatched masks. Every device in a subnet, and its gateway, must use the same mask. A device with the wrong mask can reach some neighbours and not others.
Going further
The binary arithmetic behind all of this, including how the mask selects the network part of an address, is explained step by step in How Subnetting Works. Keep CIDR and Subnet Mask Cheat Sheet handy for every prefix from /8 to /32 with its mask and wildcard.