Connect via MCP →

Enter Calculation

Formula

Advertisement

Results

Subnets Allocated
4
total addresses used: 116
Needed Network Prefix Usable First Host Last Host Broadcast
50 192.168.1.0 /26 62 192.168.1.1 192.168.1.62 192.168.1.63
20 192.168.1.64 /27 30 192.168.1.65 192.168.1.94 192.168.1.95
10 192.168.1.96 /28 14 192.168.1.97 192.168.1.110 192.168.1.111
2 192.168.1.112 /30 2 192.168.1.113 192.168.1.114 192.168.1.115

What is a VLSM Calculator?

Variable Length Subnet Masking (VLSM) lets network engineers divide a single IP block into subnets of different sizes, matching each subnet to its actual host requirement. This avoids wasting addresses that fixed-length subnetting would squander. This calculator takes a base network address and a list of host counts, then allocates contiguous subnets from largest to smallest.

How to Use It

Enter the starting network address (for example 192.168.1.0) and a comma-separated list of how many hosts each subnet must support (for example 50, 20, 10, 2). The tool sorts requirements from largest to smallest, then assigns each one the smallest subnet that fits, packing them end to end so no address space is wasted.

The Formula Explained

For each host requirement h, you need room for h hosts plus a network address and a broadcast address, so h + 2 addresses total. The prefix is $$\text{Prefix} = 32 - \left\lceil \log_{2}\!\left( h + 2 \right) \right\rceil$$ and the block size is \(2^{32 - \text{Prefix}}\). For example, 50 hosts needs 52 addresses; \(\lceil \log_{2}(52) \rceil = 6\), so the prefix is /26 with a block of 64 addresses and 62 usable hosts.

Advertisement
Diagram showing a host count rounded up to the next power of two to determine subnet block size and prefix length
Each host requirement is rounded up to the next power of two (plus network and broadcast) to set the subnet block size and prefix.

Worked Example

Base network 192.168.1.0 with requirements 50, 20, 10, 2: the /26 (64 addresses) goes to the 50-host LAN at 192.168.1.0, the /27 (32 addresses) for 20 hosts starts at 192.168.1.64, the /28 (16 addresses) for 10 hosts starts at 192.168.1.96, and a /30 (4 addresses) for the 2-host point-to-point link starts at 192.168.1.112. Total used: 116 addresses.

A large base network block divided into variable-sized subnet blocks of decreasing size
VLSM packs subnets of different sizes into the base network, largest first, with no wasted address space.

FAQ

Why +2 hosts? Every IPv4 subnet reserves one address for the network ID and one for broadcast, so usable hosts equal block size minus two.

Why sort largest first? Allocating the biggest subnets first keeps blocks aligned to their natural boundaries and prevents fragmentation.

What is the smallest practical subnet? A /30 gives 2 usable hosts, ideal for router-to-router links; /31 is sometimes used for point-to-point with no broadcast.

Last updated: