VLSM Calculator

Allocate a base network across required host counts with variable-length subnet masking.

  • Runs locally in your browser
  • No upload required

Try it

/25 — 100 hosts needed
192.168.0.0 – 192.168.0.127 (126 usable, 26 spare)
/26 — 50 hosts needed
192.168.0.128 – 192.168.0.191 (62 usable, 12 spare)
/27 — 20 hosts needed
192.168.0.192 – 192.168.0.223 (30 usable, 10 spare)
Remaining
192.168.0.224 (32 addresses)
Base: 192.168.0.0/24
Needed   Prefix  Network            Range                          Usable  Waste
100      /25    192.168.0.0        192.168.0.0 – 192.168.0.127  126     26
50       /26    192.168.0.128      192.168.0.128 – 192.168.0.191  62      12
20       /27    192.168.0.192      192.168.0.192 – 192.168.0.223  30      10
Remaining: 192.168.0.224 (32 addresses)

Supported formats

Input
text
Output
text, number

Privacy

Runs entirely in your browser. Your input is never uploaded, stored, or sent to a third party.

Processing
In your browser
Privacy level
Browser only

Allocated 3 subnet(s) from 192.168.0.0/24.

How it works

  • Sorted the requested host counts from largest to smallest.
  • For each requirement, chose the smallest prefix whose usable host count fits.
  • Aligned the block to its size and advanced the allocation cursor.
  • Reported the remaining space starting at 192.168.0.224.
textSelect to copy
block size = 2^(32 − prefix); usable = block size − 2
  • The largest requirement is allocated first, which is what makes the plan fit as often as possible.
  • A requirement larger than the base block is reported as an error rather than silently dropped.

Methodology

  1. Parse the base CIDR block and the list of required host counts.
  2. Sort requirements descending and choose the smallest prefix that fits each.
  3. Align each block to its size, advance the cursor and detect exhaustion.
  4. Report every segment plus the remaining address space.

Usage

  1. Enter the base CIDR block.
  2. List one required host count per line (or comma separated).
  3. Run the allocation and copy the plan.

Examples

These are examples, not current values: they use fixed inputs, while the interactive tool computes live results in your browser.

Three departments in a /24

jsonSelect to copy
{
  "base": "192.168.0.0/24",
  "requirements": "100\n50\n20"
}

Two point-to-point links and a /25

jsonSelect to copy
{
  "base": "10.0.0.0/24",
  "requirements": "120,2,2"
}

Limitations

Why VLSM exists

A single subnet size wastes address space when a site has very different needs: a transit link needs two addresses while a user LAN might need hundreds. VLSM lets each segment choose its own prefix so the address plan fits the requirements.

Allocating the largest block first is the common heuristic: it keeps the alignment simple and leaves the most room for the smaller blocks that follow.

Frequently asked questions

Which subnet is allocated first?
The largest requirement is allocated first so the smaller blocks can fill the remaining space; this is the standard VLSM heuristic.
What if my requirements do not fit?
The tool reports the point at which the base block ran out and lists the successfully allocated segments, without throwing.

Sources

  1. RFC 4632: Classless Inter-domain Routing (CIDR) — IETF
  2. RFC 950: Internet Standard Subnetting Procedure — IETF