This VLSM calculator builds an address plan from a list of host requirements. It sorts them largest first, gives each the smallest block that fits, places every block on its natural boundary, detects overlaps with space you have already used, and reports utilisation, the leftover blocks and a CSV you can paste into a spreadsheet or IPAM.
Result
The result updates automatically as you change any input.
Formula and worked steps
Formulas used
- Prefix for h hosts = smallest p with 2^(32 - p) - 2 >= h (a /31 when h <= 2 and /31 is allowed)
- Allocate largest first, each at the first free address aligned to its block size
- Utilisation = allocated addresses / addresses in the base network
- Host efficiency = hosts needed / usable hosts in the allocated blocks
- Each requirement already includes any growth you want; add it to the host count before entering.
- Blocks are aligned to their own size, as subnetting requires, so a free hole may not fit a larger block.
- Already-allocated blocks are treated as occupied and are checked for overlap with each other and for lying outside the base network.
References
Planning iSCSI or NFS networks? The iSCSI subnet calculator has a smaller VLSM planner built in, plus IQN checks and fabric A/B subnets.
What is VLSM?
Variable length subnet masking means using different prefix lengths inside one address block, so a 100-host department gets a /25 while a router link gets a /30. It replaced the old habit of cutting a network into equal pieces, which wasted most of the space when requirements differed. VLSM works because routing is classless (CIDR), so each subnet carries its own mask.
Why largest first
Every subnet must start on a multiple of its own size. A /25 can only begin at .0 or .128, a /26 at .0, .64, .128 or .192. If you place small subnets first they land in the middle of the space and break up the aligned runs that big subnets need. Allocating the biggest block first keeps free space in large contiguous pieces, which is why the calculator sorts your list before it places anything.
Host requirements and block sizes
A block with prefix p offers 2^(32 − p) − 2 usable hosts. Needing 100 hosts rules out /26 (62) and chooses /25 (126). Needing 2 hosts chooses /30 (2 usable), or /31 if you allow RFC 3021 on point-to-point links. The unused part of each block, the spare hosts, is the price of binary alignment.
How the VLSM calculator works
Formulas
For each requirement the tool finds the smallest prefix whose usable host count covers it, then scans from the start of the base network for the first free address that is a multiple of the block size and does not overlap anything already placed. Utilisation is the allocated address count divided by the size of the base network.
Worked example: a /24 for six segments
Take 192.168.1.0/24 with needs of 100, 50, 20, 10, 2 and 2 hosts. The results are a /25 (192.168.1.0), a /26 (192.168.1.128), a /27 (192.168.1.192), a /28 (192.168.1.224) and two /30 links at .240 and .244. That uses 128 + 64 + 32 + 16 + 4 + 4 = 248 of 256 addresses, 96.9%, and leaves 192.168.1.248/29 free. The hosts needed (184) against usable hosts in the blocks (236) is 78%, which shows how much room each block carries for growth.
Overlap detection
Paste blocks that are already in use, one CIDR per line, and the tool places new subnets around them. It also warns when two used blocks overlap, or when one lies outside your base network, which usually means a typo or a stale spreadsheet. Overlaps are the most common reason two sites cannot talk after a merge or a cloud peering.
Leftover space
The leftover list is the base network minus everything allocated, written as the fewest CIDR blocks. Treat it as your reserve: it shows what the next team can still be given and whether a request for a /26 will fit or force a new block.
Alignment waste and spare hosts
Two kinds of space are lost in any VLSM plan. Spare hosts are the unused addresses inside a block, such as the 26 spare hosts when 100 hosts sit in a /25 that can hold 126. Alignment gaps are free runs that are too small or badly placed to hold the next block you need. The first is the price of binary sizes and is the same no matter what order you work in. The second is what largest-first allocation minimises, and the leftover list shows exactly what remains.
Growth planning
The host count is a requirement, not a forecast. If a segment will grow from 40 to 70 hosts within two years, enter 70 now, because the move from a /26 to a /25 later means renumbering. Round up deliberately: an address plan that is 97% utilised on day one has no room for a new VLAN, a second gateway for redundancy or a monitoring subnet.
Exporting the plan
The CSV button writes name, hosts needed, network, mask, first and last usable, usable hosts and spare hosts for every block, followed by the leftover blocks. Paste it into your IPAM or a design document so the plan and the configuration come from the same numbers.
Using the plan with routing
Once the blocks are allocated, check how they will be advertised. Each site’s blocks should sit together inside one aligned range so a single summary covers them. The allocation table is sorted by address in the final output, so you can see at a glance whether a site’s subnets are contiguous or scattered among other sites’ space.
Why it matters for network engineers
An address plan is a long-lived contract. Once subnets are in routers, firewalls and DHCP scopes, changing them means outages. Planning the whole block up front, with the biggest subnets first and a documented reserve, keeps the plan summarisable so each site can be announced as one prefix. That is what keeps routing tables small, and you can test the result with the route summarization calculator.
For a single subnet with a binary view, use the IPv4 subnet calculator. If your list includes storage networks, the iSCSI subnet calculator adds IQN validation to a smaller VLSM planner.
Best practices and common mistakes
Add growth before you enter the host counts; 30% to 50% is a common allowance for user VLANs. Leave an aligned block free between sites rather than packing everything tightly, so sites can grow without renumbering. Keep point-to-point links in a dedicated range so they can be summarised or left out of the routing table entirely.
Do not size a DHCP subnet to the exact device count: size the scope with the DHCP scope calculator and then pick the block. Do not plan on a /31 until you have checked both ends support it. And never edit the plan by hand in a spreadsheet without re-running it: a single moved block can silently overlap its neighbour.
FAQs
Why sort VLSM requirements largest first?
Each subnet must start on a boundary that is a multiple of its size. Placing the largest blocks first keeps them aligned and leaves the free space in big contiguous pieces for the smaller subnets.
How many hosts fit in a /26?
A /26 has 64 addresses and 62 usable hosts, because the network and broadcast addresses are not assignable.
What is the smallest subnet for a router link?
A /30 gives two usable hosts on every device. A /31 also gives two and wastes nothing (RFC 3021), but both ends of the link must support it.
How do I know if two subnets overlap?
Two blocks overlap if their address ranges share any address. The calculator compares the start and end of every block you list and warns about each overlap and each block outside the base network.
Next, try the IPv4 subnet calculator, the route summarization calculator and DHCP scope calculator, or browse all IP & Addressing calculators and the full list of network calculators.