VLSM Calculator
Divide an IPv4 network into subnets of different sizes based on required host counts. Outputs CIDR, mask, range, and broadcast.
Enter one requirement per line. Optional label, comma, host count. Example: Sales, 50
| Label | Required | Assigned | CIDR | Range | Broadcast |
|---|---|---|---|---|---|
| Sales | 50 | 62 | 192.168.1.0/26 | 192.168.1.1 – 192.168.1.62 | 192.168.1.63 |
| Engineering | 20 | 30 | 192.168.1.64/27 | 192.168.1.65 – 192.168.1.94 | 192.168.1.95 |
| Admin | 10 | 14 | 192.168.1.96/28 | 192.168.1.97 – 192.168.1.110 | 192.168.1.111 |
| Guests | 5 | 6 | 192.168.1.112/29 | 192.168.1.113 – 192.168.1.118 | 192.168.1.119 |
120 / 256 addresses used
Understanding Variable Length Subnet Masking
VLSM is the evolution of classful subnetting that eliminated the rigid one-size-fits-all approach to IP address allocation. In the early internet, organizations received Class A, B, or C network blocks with fixed subnet masks, wasting enormous numbers of addresses. A company needing 300 hosts would receive a Class B block with 65,534 addresses. CIDR and VLSM, formalized in RFC 1878 and RFC 4632, replaced this system by allowing subnet masks of any length, so each subnet can be sized to its actual need.
The largest-first allocation algorithm is central to efficient VLSM design. Each subnet size has a natural alignment requirement: a /26 block (64 addresses) must begin at an address divisible by 64, a /27 block (32 addresses) at a multiple of 32, and so on. By sorting requirements from largest to smallest and allocating in that order, each subnet naturally falls on its required boundary. Attempting to allocate smaller subnets first would create gaps when larger subnets need to skip to their next valid alignment point.
In practice, VLSM is used everywhere networks have segments of different sizes. A campus network might need a /23 for a large building, several /25 blocks for medium departments, and /30 point-to-point links between routers. Branch office designs typically allocate a /24 or /23 for the site, then subdivide with VLSM for data, voice, management, and wireless VLANs. The key advantage is that no address space is stranded in oversized subnets, and the remaining unallocated space stays available for future growth.
Frequently Asked Questions
What is VLSM?
Variable Length Subnet Masking allows an IP network to be divided into subnets of different sizes, unlike fixed-length subnetting where all subnets are the same size. VLSM was introduced as part of CIDR (RFC 1878, RFC 4632) and is supported by all modern routing protocols (OSPF, EIGRP, BGP). It avoids wasting addresses by matching each subnet to its actual host count.
Why are subnets allocated largest-first?
Larger subnets have stricter alignment requirements. A /26 (64 addresses) must start on a 64-address boundary. Allocating largest-first guarantees alignment without wasting space on padding. If smaller subnets were allocated first, the next large subnet might need to skip ahead to reach its alignment boundary.
What happens to the unused address space?
After VLSM allocation, any remaining addresses in the parent block are available for future subnets. This calculator shows the total used vs. total available counts. The unused space can be subdivided later without affecting existing allocations.
Can I use VLSM with any routing protocol?
VLSM requires a classless routing protocol that carries prefix length information. OSPF, IS-IS, EIGRP, and BGP all support VLSM. RIPv1, which only handles classful networks, does not. RIPv2 added classless support and works with VLSM.
How do I calculate the minimum prefix for N hosts?
The formula is: find the smallest power of 2 that is ≥ N + 2 (network and broadcast), then the prefix = 32 minus the exponent. For 50 hosts: next power of 2 ≥ 52 is 64 (2^6), so prefix = 32 - 6 = /26, giving 62 usable hosts.