VLSM Calculator

Enter a network and the hosts each subnet needs. The plan below is filled in for 192.168.1.0/24 with 60, 30, 12 and 2 hosts, and it updates as you edit the table.

/

Paste a list into any name field (one subnet per line, e.g. Sales 120) to fill the table. Lines without a host count are kept as rows and flagged, never dropped.

Subnet nameHosts neededRemove
Saved plans (stored in this browser)

Allocation

largest first · aligned to block size

parent 192.168.1.0/24 subnets 4 allocated 116 of 256 (45.3%) free 140

Largest first: LAN takes the first /26 (64 addresses), so every smaller block that follows starts on a multiple of its own size with no gaps.

SubnetHosts neededBlock sizePrefixNetworkFirst usableLast usableBroadcastSubnet maskWasted
LAN6064/26192.168.1.0192.168.1.1192.168.1.62192.168.1.63255.255.255.1922
Staff3032/27192.168.1.64192.168.1.65192.168.1.94192.168.1.95255.255.255.2240
Lab1216/28192.168.1.96192.168.1.97192.168.1.110192.168.1.111255.255.255.2402
Link24/30192.168.1.112192.168.1.113192.168.1.114192.168.1.115255.255.255.2520

How this plan was worked out

  1. Sort the requests by host count, largest first: LAN 60, Staff 30, Lab 12, Link 2. Equal sizes keep the order you typed.
  2. Add the 2 reserved addresses and round up to a power of two. LAN: 60 + 2 = 62 rounds up to 64; Staff: 30 + 2 = 32 rounds up to 32; Lab: 12 + 2 = 14 rounds up to 16; Link: 2 + 2 = 4 rounds up to 4.
  3. The block size is the prefix and the mask. 64 addresses is /26 (255.255.255.192); 32 addresses is /27 (255.255.255.224); 16 addresses is /28 (255.255.255.240); 4 addresses is /30 (255.255.255.252).
  4. Allocate from 192.168.1.0. LAN takes 192.168.1.0–192.168.1.63. The next subnet starts at 192.168.1.64. Staff takes 192.168.1.64–192.168.1.95. The next subnet starts at 192.168.1.96. Lab takes 192.168.1.96–192.168.1.111. The next subnet starts at 192.168.1.112. Link takes 192.168.1.112–192.168.1.115.
  5. This uses 116 of 256 addresses. 140 remain. 4 addresses are unused inside the subnets (usable hosts above the request).

Free blocks: 192.168.1.116/30 192.168.1.120/29 192.168.1.128/25

Split tree

Each split halves a block. Select a split to fold or unfold it.

192.168.1.0/24split into 2 × /25256 192.168.1.0/25split into 2 × /26128 192.168.1.0/26LAN64 192.168.1.64/26split into 2 × /2764 192.168.1.64/27Staff32 192.168.1.96/27split into 2 × /2832 192.168.1.96/28Lab16 192.168.1.112/28split into 2 × /2916 192.168.1.112/29split into 2 × /308 192.168.1.112/30Link4 192.168.1.116/30free4 192.168.1.120/29free8 192.168.1.128/25free128

Export


name,hostsRequested,cidr,netmask,firstHost,lastHost,broadcast,usableHosts,wasted
LAN,60,192.168.1.0/26,255.255.255.192,192.168.1.1,192.168.1.62,192.168.1.63,62,2
Staff,30,192.168.1.64/27,255.255.255.224,192.168.1.65,192.168.1.94,192.168.1.95,30,0
Lab,12,192.168.1.96/28,255.255.255.240,192.168.1.97,192.168.1.110,192.168.1.111,14,2
Link,2,192.168.1.112/30,255.255.255.252,192.168.1.113,192.168.1.114,192.168.1.115,2,0

How to calculate VLSM step by step

The example loaded above is 192.168.1.0/24 (256 addresses) and four subnets that need 60, 30, 12 and 2 hosts. Work it by hand the same way the table does.

  1. Sort by hosts, largest first: LAN 60, Staff 30, Lab 12, Link 2.
  2. Add 2 for the network and broadcast addresses, then round up to a power of two. 60 + 2 = 62 → 64. 30 + 2 = 32 → 32. 12 + 2 = 14 → 16. 2 + 2 = 4 → 4.
  3. Those sizes are the prefixes. 64 addresses is a /26 (255.255.255.192). 32 is a /27 (255.255.255.224). 16 is a /28 (255.255.255.240). 4 is a /30 (255.255.255.252).
  4. Start at 192.168.1.0. LAN takes 192.168.1.0–192.168.1.63, so the next subnet starts at 192.168.1.64. Staff takes 192.168.1.64–192.168.1.95 (hosts .65–.94, broadcast .95), and the next starts at 192.168.1.96. Lab takes 192.168.1.96–192.168.1.111 (hosts .97–.110, broadcast .111), and the next starts at 192.168.1.112. Link takes 192.168.1.112–192.168.1.115 (hosts .113–.114, broadcast .115).
  5. The four blocks use 64 + 32 + 16 + 4 = 116 addresses. 140 of the /24 are still free, beginning at 192.168.1.116. Inside the subnets, LAN has 2 unused hosts (62 usable, 60 needed) and Lab has 2 (14 usable, 12 needed). Staff and Link waste none.

How to calculate the VLSM subnet mask

The mask comes from the host count, not from the parent. Add 2, round up to a power of two, and that block size is the prefix. The prefix written as 32 ones and zeros, in dotted decimal, is the subnet mask. A /26 is 26 ones: 255.255.255.192.

Hosts neededHosts + 2Block sizePrefixSubnet mask
244/30255.255.255.252
688/29255.255.255.248
141616/28255.255.255.240
303232/27255.255.255.224
626464/26255.255.255.192
126128128/25255.255.255.128
254256256/24255.255.255.0

60 hosts are not a row of their own: 62 rounds up to the same 64-address block as 62 hosts, so the mask is still 255.255.255.192. Open any row in the Subnet calculator, look up the prefix on the Subnet cheat sheet, or try the same sizes on subnetting practice.

Capacity rule changes the math, not just the label. The generic rule reserves the network and broadcast addresses, and the /31 and /32 options give two-host links and single-host requests (loopbacks, host routes) their smallest legal blocks. AWS VPC and Azure VNet reserve five addresses per subnet (the first four and the last) and enforce a minimum size (/28 and /29); Google Cloud reserves the first two and the last two and enforces /29. The first and last usable address in the table follow those positions, and AWS also caps a subnet at /16, so a request that would need a larger block is rejected. A 60-host request gets a /25 on AWS instead of a /26, and the cloud exports show no warnings because the plan was built under the same rule.

To check one of the subnets in detail, open it in the subnet calculator. The subnetting tutorial works through a VLSM design by hand. For fixed, ready-to-read plans, see the AWS three-tier VPC and Azure hub-spoke examples.

Questions

What is VLSM?

Variable Length Subnet Masking gives each subnet its own prefix length, chosen from how many hosts that subnet needs. A 60-host LAN can take a /26 while a point-to-point link takes a /30, instead of forcing every subnet to share one mask.

What is the difference between VLSM and FLSM?

FLSM (fixed-length subnet masking) cuts a network into equal pieces, so every subnet has the same mask. VLSM allows different masks inside one parent. FLSM is simpler to write out; VLSM leaves fewer unused addresses when the host counts differ.

Why allocate the largest subnet first?

A subnet has to start on a multiple of its own size. Placing the largest block first keeps every smaller block that follows aligned, with no gaps. In that order, a list fits whenever the sum of the block sizes fits in the parent.

What happens if the subnets don't fit?

The calculator names the subnet that does not fit, how many addresses are left, how many the plan is short by, and the smallest prefix that would hold every request. It does not drop a subnet or return a partial plan without saying so.

Does VLSM apply to IPv6?

IPv6 LANs are almost always a /64, so sizing a subnet from a host count is an IPv4 practice. You still split a large IPv6 prefix into smaller prefixes, such as a /48 into /56 site blocks. That is prefix planning, which the IPv6 subnet plan does, rather than this host-count calculator.