How is VLSM different from fixed-size subnetting?
Traditional subnetting (with a fixed mask) splits a network into subnets that are all the same size: if you take a /24 and split it into eight /27 subnets, each one gets exactly 30 usable hosts, whether it actually needs 2 devices or 25. It's simple to calculate, but it wastes addresses as soon as real-world requirements aren't evenly distributed.
VLSM (Variable Length Subnet Mask) fixes that waste by giving each subnet the tightest prefix that matches what it actually needs, instead of a one-size-fits-all block. A subnet that only needs 2 hosts for a point-to-point link can use a /30 or even a /31, while the floor with 100 people gets a /25. The result is that the same base network serves far more departments than fixed subnetting would, because you're not handing out addresses to whoever doesn't need them.
The trade-off is that VLSM demands more discipline when planning: subnets have to be assigned from largest to smallest and packed contiguously, with no gaps, so the addressing stays valid and easy to summarize in routing tables.
How each block is calculated
For every requirement, the algorithm:
- Takes the number of hosts requested and adds 2 (one network address, one broadcast address).
- Rounds that number up to the nearest power of 2. For example, 14 hosts need 16 addresses (14 + 2 = 16, already a power of 2); 20 hosts need 32 addresses (20 + 2 = 22, rounded up to 32).
- Converts that address count into a CIDR prefix: 32 addresses correspond to a
/27(32 = 2⁵, prefix = 32 - 5). - Sorts all requirements from largest to smallest host count, and assigns each block right after the previous one, starting from the beginning of the base network.
Sorting from largest to smallest isn't a cosmetic detail — it's exactly what guarantees each block ends up aligned to its own size automatically, with no need to manually work out each subnet's boundaries.
Worked example, step by step
Say you have the network 192.168.1.0/24 (256 addresses) and need to split it across four sites:
| Site | Hosts needed |
|---|---|
| Sales | 60 |
| Manufacturing | 28 |
| Warehouse | 12 |
| Router link | 2 |
Step 1 — Sort from largest to smallest: Sales (60), Manufacturing (28), Warehouse (12), Link (2).
Step 2 — Calculate the size of each block:
- Sales: 60 + 2 = 62 → rounds up to 64 addresses →
/26. - Manufacturing: 28 + 2 = 30 → rounds up to 32 addresses →
/27. - Warehouse: 12 + 2 = 14 → rounds up to 16 addresses →
/28. - Link: 2 + 2 = 4 → rounds up to 4 addresses →
/30.
Step 3 — Assign contiguously starting from 192.168.1.0:
| Site | Subnet | Host range | Broadcast |
|---|---|---|---|
| Sales | 192.168.1.0/26 | .1 – .62 | 192.168.1.63 |
| Manufacturing | 192.168.1.64/27 | .65 – .94 | 192.168.1.95 |
| Warehouse | 192.168.1.96/28 | .97 – .110 | 192.168.1.111 |
| Router link | 192.168.1.112/30 | .113 – .114 | 192.168.1.115 |
In total, 64 + 32 + 16 + 4 = 116 of the 256 available addresses were used, leaving 140 free for growth or future sites — something fixed-size subnetting with a single block size couldn't have achieved without wasting far more addresses on the smaller sites.
When the space isn't enough
If the sum of the required blocks exceeds the size of the base network, not every requirement will fit. This calculator doesn't stop at the first one that fails: it assigns everything that does fit (always respecting the largest-to-smallest order) and shows you exactly which requirements were left out and how many additional addresses you'd need to include them, so you can decide whether to grow the base network or split those sites into a different block.
How to use this calculator
Enter the base network and its prefix, then add one row per subnet you need, with a descriptive name and the number of hosts. The results table and utilization summary recalculate automatically with every change, and you can export the full result to CSV to document it or import it into another tool.