VLSM Calculator
Calculate variable-length subnet masks from host requirements
Subnet Requirements
4 subnetsVLSM Allocation
| Name | Network | Range | Hosts |
|---|---|---|---|
| Sales | 192.168.0.0/26 | 192.168.0.1 - 192.168.0.62 | 50/62 |
| Engineering | 192.168.0.64/27 | 192.168.0.65 - 192.168.0.94 | 30/30 |
| Management | 192.168.0.96/28 | 192.168.0.97 - 192.168.0.110 | 10/14 |
| IT | 192.168.0.112/29 | 192.168.0.113 - 192.168.0.118 | 5/6 |
The VLSM Calculator performs Variable Length Subnet Masking to carve a parent network into optimally-sized subnets based on your specific host requirements. Enter a parent network like 192.168.1.0/24 along with a list of host counts (e.g., 100, 50, 20, 2), and the tool allocates the smallest possible subnet for each segment -- returning the network address, prefix length, subnet mask, usable host range, and efficiency percentage for every allocation.
Understanding Variable Length Subnet Masking
If you have ever been handed a single /24 and told to split it among four departments that range from 100 users down to a two-device WAN link, you have already run into the problem VLSM solves. Traditional classful subnetting forces every subnet to be the same size. If you subnet a /24 into equal pieces to accommodate the largest group, the smaller groups waste most of their addresses. A department with two routers on a point-to-point link does not need 62 addresses, and giving it that many steals space from departments that could actually use it.
VLSM removes that constraint by letting each subnet use a different prefix length. The 100-host department gets a /25 (126 usable addresses), the 50-host group gets a /26 (62 usable), the 20-host team gets a /27 (30 usable), and the WAN link gets a /30 (2 usable). All four fit inside the same /24 parent block, and overall utilization jumps from well under 50% to above 80%. This is why VLSM became the standard approach for IPv4 network design the moment CIDR made it possible -- every usable address in the RFC 1918 space matters, and wasting them on oversized subnets is a luxury most organizations cannot afford.
The calculator automates the math that would otherwise involve sorting requirements, computing powers of two, aligning subnets on bit boundaries, and tracking remaining free space. You provide the parent block and the host counts, and it returns a complete allocation table along with a summary of used and remaining address space. Whether you are planning a real production network or working through a CCNA practice problem, the output gives you everything you need to verify and document the design.
How to Calculate VLSM Subnets
- Enter your parent network in CIDR notation (e.g.,
192.168.1.0/24or10.0.0.0/16) - List the number of hosts required for each subnet, one per line
- The calculator sorts requirements from largest to smallest
- Each subnet is allocated the smallest prefix length that fits the host count plus network and broadcast addresses
- Review the output showing each subnet's network address, mask, usable range, and efficiency
VLSM Calculation Examples
Given a parent network of 192.168.1.0/24 with the following host requirements:
| Subnet Name | Hosts Needed | Allocated Prefix | Network Address | Usable Range | Usable Hosts | Efficiency |
|---|---|---|---|---|---|---|
| Engineering | 100 | /25 | 192.168.1.0/25 | 192.168.1.1 - 192.168.1.126 | 126 | 79.4% |
| Sales | 50 | /26 | 192.168.1.128/26 | 192.168.1.129 - 192.168.1.190 | 62 | 80.6% |
| Management | 20 | /27 | 192.168.1.192/27 | 192.168.1.193 - 192.168.1.222 | 30 | 66.7% |
| WAN Link | 2 | /30 | 192.168.1.224/30 | 192.168.1.225 - 192.168.1.226 | 2 | 100% |
Total used: 220 out of 256 addresses (85.9% utilization)
Remaining: 192.168.1.228/30, 192.168.1.232/29, 192.168.1.240/28 (36 addresses)
Prefix Length to Usable Hosts Reference
| Prefix | Subnet Mask | Total Addresses | Usable Hosts |
|---|---|---|---|
/24 | 255.255.255.0 | 256 | 254 |
/25 | 255.255.255.128 | 128 | 126 |
/26 | 255.255.255.192 | 64 | 62 |
/27 | 255.255.255.224 | 32 | 30 |
/28 | 255.255.255.240 | 16 | 14 |
/29 | 255.255.255.248 | 8 | 6 |
/30 | 255.255.255.252 | 4 | 2 |
When to Use the VLSM Calculator
- Network design -- plan subnets for a new office, campus, or data center deployment
- Address conservation -- maximize utilization of limited IPv4 space by right-sizing every subnet
- Certification study -- practice VLSM subnetting for CCNA, CompTIA Network+, and JNCIA exams
- Cloud VPC planning -- allocate subnet blocks for AWS VPCs, Azure VNets, or GCP networks
- WAN link addressing -- allocate
/30or/31subnets for point-to-point router links - Network expansion -- verify that new subnets fit within remaining free space in a parent block
How Variable Length Subnet Masking Works
Traditional classful subnetting divides a network into equal-sized subnets. If you need one subnet with 200 hosts and another with 2, both get the same size -- wasting addresses in the smaller subnet. VLSM solves this by allowing each subnet to use a different prefix length.
The VLSM Allocation Algorithm
- Sort all host requirements from largest to smallest
- Calculate the minimum prefix length for each: find the smallest power of 2 that is greater than or equal to (hosts needed + 2)
- Allocate the largest subnet first, starting at the parent network address
- Place each subsequent subnet at the next available aligned boundary
- Validate that all subnets fit within the parent block
The "+2" accounts for the network address (first address, all host bits zero) and broadcast address (last address, all host bits one), which cannot be assigned to hosts.
Why Largest-First Ordering Matters
Allocating the largest subnets first ensures proper bit-boundary alignment. A /25 must start on a 128-address boundary, a /26 on a 64-address boundary, and so on. Allocating small subnets first can fragment the space and make it impossible to fit larger blocks later, even when total available addresses would be sufficient.
Worked Example: Bit-Level Allocation
For the Engineering subnet requiring 100 hosts from 192.168.1.0/24:
Hosts needed: 100
Next power of 2 >= (100 + 2): 128 → prefix /25
Subnet mask: 255.255.255.128
Network: 192.168.1.0/25 (11000000.10101000.00000001.0|0000000)
Broadcast: 192.168.1.127 (11000000.10101000.00000001.0|1111111)
Next available: 192.168.1.128 (start of next /26 for Sales)
The vertical bar separates the 25 network bits from the 7 host bits. The next subnet (Sales, 50 hosts) starts at 192.168.1.128, which is naturally aligned on a 64-address boundary for its /26 prefix.
VLSM Planning Best Practices
The biggest mistake engineers make with VLSM is sizing subnets exactly to today's device count. A subnet with 50 devices and a /26 (62 usable hosts) works right now, but one office expansion or a wave of new IoT sensors pushes it past capacity and forces a painful re-addressing project. Add a growth buffer of at least 30-50% to every host count before you start the calculation. If you have 50 devices today, enter 75 or 80 as your requirement so the calculator selects a subnet that can absorb growth without a redesign.
The second pitfall is ignoring the remaining free space. After your allocations are placed, the leftover fragments are not always usable for future needs. A remaining block of 192.168.1.228/30 is only useful for a two-host WAN link, not for a future 30-device VLAN. When planning VLSM allocations, deliberately leave a contiguous unallocated block at the end of your parent network for future growth rather than letting the algorithm scatter small remainders throughout the range.
Finally, document the allocation immediately. A VLSM plan that lives only in one engineer's head becomes a liability the moment that person is unavailable. Export the calculator output, add subnet names and VLAN IDs, and store it in your IPAM system or at minimum a shared spreadsheet. The VLSM Report Generator can format this documentation automatically.
Frequently Asked Questions
What is the difference between VLSM and CIDR?
VLSM and CIDR are related but distinct concepts. CIDR (Classless Inter-Domain Routing) eliminates the old Class A/B/C boundaries and allows arbitrary prefix lengths in routing. VLSM specifically refers to using different prefix lengths for subnets within the same network. VLSM is a subnetting technique that was enabled by CIDR's flexible addressing.
Can VLSM be used with IPv6?
While VLSM concepts apply to any IP version, IPv6's vast address space (/48 allocations provide 65,536 /64 subnets) makes aggressive conservation less critical. Most IPv6 deployments use a uniform /64 prefix for all subnets. VLSM is primarily relevant for IPv4 address planning.
What happens if my host requirements exceed the parent network?
The calculator validates total requirements against available space. If the combined subnet allocations exceed the parent network's capacity, you will receive a warning indicating how many additional addresses are needed. You will need to either reduce requirements or use a larger parent block.
How do I account for future growth?
Add a growth margin to each host count before calculating. A common practice is to double the current requirement or add 20-50% headroom. For example, if a department currently has 40 hosts, enter 60 or 80 to allow room for expansion without re-subnetting later.
Why does my largest subnet waste more addresses than the smaller ones?
VLSM minimizes waste compared to classful subnetting, but it cannot eliminate it entirely. Subnet sizes are powers of two (minus the two reserved addresses), so a requirement for 100 hosts gets a /25 with 126 usable addresses -- a 79% efficiency. The gap narrows as requirements approach a power of two. A requirement for 62 hosts fits perfectly in a /26 at near 100% efficiency.
Can I use VLSM across multiple parent networks?
Yes. If one parent block does not have enough space, you can run VLSM allocations on a second block. Just ensure the two parent networks do not overlap and that your routing configuration handles both blocks correctly. The Duplicate Subnet Detector can verify there are no conflicts.
Related Tools
- VLSM Report Generator - Export your VLSM allocations as formatted reports
- Address Plan Generator - Generate complete IP address plan templates with VLAN and DHCP fields
- DHCP Scope Size Calculator - Determine the right subnet size for DHCP pools
- Wasted Space Estimator - Analyze how much address space is unused in your allocations
- Duplicate Subnet Detector - Check your subnet plan for overlapping allocations
- IPv4 Subnet Calculator - Calculate detailed subnet information from any IP and CIDR prefix