VLSM Subnet Calculator (Variable Length Subnet Masks)
Split an IPv4 network into variable-length subnets (VLSM) for a list of host requirements: network address, prefix, mask, usable range and broadcast of each subnet, plus space used and left.
How it works
block size = smallest power of 2 ≥ hosts + 2 (network and broadcast) · prefix = 32 − log₂(block size) · allocate the largest blocks first, each starting where the previous ended · usable range = network + 1 … broadcast − 1
Variable Length Subnet Masking (VLSM, RFC 1878 and the CIDR rules of RFC 4632) lets each subnet get a mask sized to its own host count instead of splitting a network into equal pieces. Allocating the largest subnets first keeps every block aligned on a multiple of its own size, so no addresses are lost to gaps. Each subnet reserves two addresses (network and broadcast); point-to-point links get a /30 here, though /31 is also allowed on routers that support RFC 3021.
Worked example
Splitting 192.168.10.0/24 for 100, 50, 25, 10 and 2 hosts gives 192.168.10.0/25 (126 usable), .128/26 (62), .192/27 (30), .224/28 (14) and .240/30 (2). That allocates 244 / 256 addresses (95.31%), leaves 12 from 192.168.10.244, and 47 host addresses inside the subnets stay unused.
Sources: RFC 1878 — Variable Length Subnet Table for IPv4 · RFC 4632 — Classless Inter-domain Routing (CIDR)
Frequently asked questions
What is VLSM?
Variable Length Subnet Masking: dividing one network into subnets of different sizes, each with the shortest mask that still fits its hosts. It wastes far fewer addresses than fixed-length subnetting.
Why allocate the largest subnet first?
A block of size 2^n must start on a multiple of 2^n. Placing big blocks first guarantees every following smaller block is aligned, so the subnets pack with no gaps.
How many hosts fit in each prefix?
/30 = 2, /29 = 6, /28 = 14, /27 = 30, /26 = 62, /25 = 126, /24 = 254 usable hosts — always 2^(32 − prefix) − 2.
Does VLSM require a classless routing protocol?
Yes. The routers must carry the mask with each route: OSPF, EIGRP, IS-IS, BGP and RIPv2 do; RIPv1 and IGRP do not.
Related calculators
This calculator is for educational purposes. Double-check important results before acting on them.