VLSM Calculator: Variable-Length Subnet Planner with CIDR Blocks and Ranges

This VLSM calculator splits one IPv4 network into subnets of different sizes. Enter the parent network and the number of hosts each subnet needs, and it returns a subnet for each requirement, with its network address, prefix length, mask, usable range and broadcast address, and shows how much of the address space is left over.

Computing & Networking Tools Calculators

VLSM Calculator

Plan variable-length subnets: enter a parent network and the hosts each subnet needs, get aligned CIDR blocks, ranges, broadcasts and unused space.

For example 192.168.1.0/24 or 10.0.0.0/16.
Write a name and a host count, or just a number. Example: Sales 50
Each subnet needs hosts + 2 addresses (network and broadcast). Blocks are rounded up to the next power of two, so a /30 is the smallest block this planner uses.

Starting values: the calculator opens with 192.168.1.0/24 and four requirements: Sales 50 hosts, HR 20 hosts, IT 10 hosts and a router link of 2 hosts. It allocates 192.168.1.0/26, 192.168.1.64/27, 192.168.1.96/28 and 192.168.1.112/30.

What VLSM means

VLSM stands for variable length subnet masking. With fixed-size subnetting, every subnet gets the same mask, so a 2-host router link wastes as many addresses as a 50-host office. With VLSM, each subnet gets the smallest mask that fits its own host count, so the parent block is shared out without waste. It is the standard way to plan an addressing scheme when the departments or links differ in size.

How the calculator sizes each subnet

  1. Add 2 to each host count, because every subnet loses its network address and its broadcast address.
  2. Round that number up to the next power of two. This is the block size.
  3. Work out the prefix: a block of 2 to the power n addresses uses a prefix of 32 minus n.
  4. Sort the requirements from largest to smallest and place each block one after another, starting at the beginning of the parent network.

The calculator uses /30 as the smallest subnet, so a link that needs only 2 hosts gets 4 addresses.

Placing the largest block first matters. Blocks must start on a multiple of their own size, and starting with the biggest keeps every later block correctly aligned without gaps.

Worked examples

Example 1: the default office network

Sales needs 50 hosts, so 52 addresses rounds up to 64, which is a /26 with 62 usable hosts. HR needs 20, so 22 rounds up to 32, a /27 with 30 usable hosts. IT needs 10, so 12 rounds up to 16, a /28 with 14 usable hosts. The router link needs 2, so 4 addresses, a /30.

Placed in order, that gives 192.168.1.0/26, then 192.168.1.64/27, then 192.168.1.96/28, then 192.168.1.112/30. Together they use 64 + 32 + 16 + 4 = 116 of the 256 addresses in the /24, which leaves 140 free for later subnets.

Example 2: a larger parent block

Take 172.16.0.0/22, which holds 1,024 addresses, with requirements of 300, 100, 50 and 2 hosts. The 300-host subnet needs 302 addresses, so it rounds up to 512, a /23. The 100-host subnet needs 102, so 128, a /25. The 50-host subnet takes a /26 and the link takes a /30.

The allocation is 172.16.0.0/23, 172.16.2.0/25, 172.16.2.128/26 and 172.16.2.192/30. They use 512 + 128 + 64 + 4 = 708 addresses, so 316 remain.

Example 3: when the requirements do not fit

If the blocks add up to more than the parent network holds, the plan cannot work. Try 192.168.1.0/24 with 100, 100 and 50 hosts. The first two need a /25 each, which fills the entire /24, and nothing remains for the third. The fix is a larger parent block, such as a /23, or fewer hosts per subnet.

Reading the results

  • Network address: the first address of the block, which identifies the subnet.
  • Usable range: every address between the network and broadcast addresses, which you can assign to hosts.
  • Broadcast address: the last address of the block.
  • Mask: the prefix written in dotted form, for example /26 is 255.255.255.192.
  • Free space: the part of the parent network that has not been assigned.

Planning tips

  • Leave room to grow. If a department might double, size its subnet for the larger number now, because renumbering later is disruptive.
  • Keep point-to-point links in one corner of the parent block, so the leftover space stays in one piece.
  • Document each allocation with its purpose. An address plan that nobody can read is hard to maintain.

Limits of this calculator

The tool handles IPv4 only. It rounds every requirement to a power of two and does not reserve extra addresses for gateways or future growth, so add those to your host counts yourself. It also does not check your plan against any routing design or against addresses already in use on your network.

Checking your answer by hand

You can verify any result in seconds. A /26 holds 64 addresses, so its blocks start at 0, 64, 128 and 192. A /27 holds 32, so blocks start every 32. If a network address does not fall on a multiple of the block size, the allocation is wrong. The broadcast address is always the next block start minus one.

Frequently asked questions

What is the difference between VLSM and CIDR?

VLSM is the practice of using different mask lengths inside one network. CIDR is the prefix notation, such as /26, and the classless routing that makes this possible.

Why do I add 2 to the number of hosts?

Each subnet loses two addresses, the network address and the broadcast address, so a subnet for 50 hosts needs at least 52 addresses.

Why are subnets sorted from largest to smallest?

Each block must start on a multiple of its own size. Placing the largest first keeps every later block aligned and avoids gaps.

What is the smallest subnet I can get?

This calculator uses /30, which gives 4 addresses and 2 usable hosts. It suits a router-to-router link.

What if the subnets do not fit in my network?

The total of all blocks is larger than the parent network. Use a larger parent block or reduce the host counts.

Mark Danny

Mark Danny

Mark Danny builds and maintains the free calculators and guides on Area of Irregular Shapes Calculator. Every calculator page explains its formula and shows a worked example, so you can check the working yourself. Spotted a mistake or have a suggestion? Email gulsher.hingoro101@gmail.com.

Articles: 754