VLSM Calculator
Allocate variable-length subnets efficiently across a network based on per-subnet host requirements.
About VLSM Calculator
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
Worked example
With the default values below, VLSM Calculator returns Allocation Summary of 4 subnets allocated from 192.168.0.0/24. Change any input above and every figure here is recalculated in your browser.
Inputs used
- Base Network Address
- 192.168.0.0
- Base Network Prefixaccepts 1–30 /
- 24 /
- Host Requirements per Subnet
- 50, 25, 10, 5
Results
- 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
- 1Values used
- 2Smallest fitting block
- 3Allocation Summary= 4 subnets allocated from 192.168.0.0/24
- 4Subnets Allocated= 4
- 5Total Hosts Requested= 90
- 6Address Space Used= 46.9
Assumptions and limits
- The result is derived only from the 3 inputs listed above. Anything not among them is not part of the calculation.
- In particular, this calculator does not take inflation, tax, fees or charges or compounding frequency into account.
- Figures are rounded for display to 1 decimal place, so totals built from several rounded parts can differ slightly from the unrounded arithmetic.
How these calculators are built and tested is described on the Methodology page. If a figure looks wrong, please report it.
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.
