VLSM Calculator
Allocate a network into variable-length subnets sized to each subnet's host requirement.
Inputs
The network you are subdividing, e.g. 192.168.0.0
Comma-separated host counts, largest first for optimal packing, e.g. 50, 25, 10, 5
Allocation Summary
4 subnets allocated from 192.168.0.0/24
Subnets Allocated
4
Total Hosts Requested
90
Address Space Used
46.9%
Step by step
Values used
Base Network Address = 192.168.0.0; Base Network Prefix = 24 /; Host Requirements per Subnet = 50, 25, 10, 5
Smallest fitting block
Find smallest prefix p where 2^(32−p) − 2 ≥ hosts needed
Allocation Summary
= 4 subnets allocated from 192.168.0.0/24
Subnets Allocated
= 4
Total Hosts Requested
= 90
Address Space Used
= 46.9
How it works
VLSM (Variable Length Subnet Masking) subdivides a network into subnets of different sizes instead of one fixed size for all, so each subnet uses only as many addresses as it needs. The standard approach sorts requirements largest-first, then for each requirement finds the smallest block (highest prefix) whose usable host count (2^(32−prefix) − 2) still meets the need, allocating sequentially from the base network to avoid overlap.
Formula
Smallest fitting block
Find smallest prefix p where 2^(32−p) − 2 ≥ hosts needed
- p
- Candidate CIDR prefix
- h
- Hosts required for that subnet
Frequently Asked Questions
Why sort host requirements largest first?
Allocating the biggest subnets first prevents small subnets from fragmenting the address space in a way that leaves no contiguous block large enough for a later, bigger requirement.
How is each subnet's size chosen?
For each host requirement, the calculator picks the smallest block (i.e., the highest CIDR prefix) whose usable host count is still greater than or equal to what's needed — this minimizes wasted addresses.
What happens if the base network is too small?
The calculator allocates as many subnets as fit and reports that the base network needs to be larger (use a smaller prefix number, e.g. /22 instead of /24) to fit every requirement.
Is VLSM different from regular subnetting (FLSM)?
Yes. Fixed-Length Subnet Masking splits a network into equal-sized subnets regardless of actual need, wasting addresses on small subnets. VLSM tailors each subnet's size to its requirement, conserving address space.