b2KIT

VLSM Calculator

Calculate Variable Length Subnet Mask allocations to efficiently divide a network into subnets of different sizes.

Tested tool guide Tested browser tools Checked August 16, 2026

What VLSM Calculator does, with a checked example

A VLSM calculator carves one IPv4 network into subnets of different sizes, like a real plan needs: a server segment with 50 hosts, a lab with 20, a link with 2. You enter the base network and a host count per segment; the tool rounds each count up to the next power-of-two block, allocates the largest subnets first, and returns one row per subnet with network address, mask, usable range, and broadcast. The part that surprises people is arithmetic, not interface: usable addresses are the block size minus two for network and broadcast, so a 50-host segment consumes 64 addresses, and the plan's footprint exceeds the sum of its hosts.

Worked example

A concrete input and expected output from the current implementation.

Input

Base network 192.168.1.0/24 with segments needing 50, 30, 20, and 5 hosts.

Expected output

Segment A: 192.168.1.0/26, usable 192.168.1.1-192.168.1.62, broadcast 192.168.1.63 (50 hosts, 62 usable)
Segment B: 192.168.1.64/27, usable 192.168.1.65-192.168.1.94, broadcast 192.168.1.95 (30 hosts, 30 usable)
Segment C: 192.168.1.96/27, usable 192.168.1.97-192.168.1.126, broadcast 192.168.1.127 (20 hosts, 30 usable)
Segment D: 192.168.1.128/29, usable 192.168.1.129-192.168.1.134, broadcast 192.168.1.135 (5 hosts, 6 usable)
Unallocated: 192.168.1.136-192.168.1.255, 120 addresses

Each host count rounds up to the smallest power-of-two block whose size minus two covers it, and blocks are assigned largest-first so every subnet starts on a boundary that its own size divides evenly. A /26 holds 62 usable addresses, enough for 50 hosts; the two /27 blocks give 30 usable each; the /29 gives 6. The footprint is 136 addresses, leaving 120 of the /24 free.

How the result is produced

1

Rounding and ordering

Each host count maps to the smallest subnet size that covers it: sizes are powers of two, 2^(32 minus prefix), and usable capacity is the size minus two. Segments are sorted largest-first, and each takes the next free block of its size, keeping boundaries aligned. Largest-first is not cosmetic: a large subnet placed after small ones can end up past the base network's end even when the totals fit.

2

The result table

Output is one row per segment: network address with prefix, usable host range, and broadcast address, plus the unallocated remainder of the base network. The rows form a contiguous span: each block ends exactly one address below the next block starts, and the sum of block sizes equals the distance from the base network's start to the last allocated address.

Good uses

  • Planning a new LAN from one purchased block, splitting it into office, lab, and server segments of different sizes with no overlaps.
  • Renumbering or merging networks, to check that an existing set of subnets fits inside the target block and to see where the spare space is.
  • Verifying a hand-drawn subnet plan from a CCNA-style exercise or router configuration before you configure equipment with it.

Limits and checks

  • Fit is judged on rounded block sizes, not host counts: fifty hosts become sixty-four addresses, and every segment rounds up, so a plan whose hosts fit can overflow the base network. The table shows the unallocated remainder; if the last block ends past the top of the base network, the request cannot fit and a segment must shrink.
  • The base network itself must be aligned: its address has to sit on a boundary for its own prefix, so entering 192.168.1.17/24 is invalid input. Enter the network address from a router config or address registry, not an arbitrary address inside the block, or every row that comes back is suspect.
  • Read the table as a contiguous span: each block's end is exactly one address below the next block's start. A gap, or ranges that repeat, means the plan was reordered or edited, and a reordered plan can place a subnet on a boundary it cannot legally occupy. A correct VLSM table never overlaps and never leaves an unaligned gap.

Common questions

Why does a segment for 50 hosts take 64 addresses?

Because a subnet must be a power-of-two block, and the first and last addresses of each block are reserved as the network and broadcast address, so usable capacity is the size minus two. A /27 holds 32 addresses but only 30 usable, short of 50 hosts, so the smallest block that works is /26 with 62 usable. The 12 spare usable addresses stay unused unless you renumber the segment.

Does the order I enter the segments change the answer?

Not the order you type: the tool sorts internally and allocates largest-first, so the same host counts always produce the same table. Order matters only if you redo the plan by hand: every subnet must start on a multiple of its own size, so a small subnet placed first can push a large one past the end of the base network even when the totals fit.

References and verification

The example and behavioral notes were checked against the browser implementation. Standards and primary references below define the relevant format, formula, or platform behavior.

Related Tools