Last updated
How to use the VLSM calculator
- Enter the network you want to split, such as 192.168.1.0/24.
- Add one row for each subnet and enter how many hosts it needs.
- Tick Use /31 for 2-host links if your point-to-point links can use a /31.
- Read the table: each subnet gets the smallest block that fits, largest first, on its own boundary.
- Check the free space list for what is left, then copy the plan.
How VLSM works
VLSM gives each subnet its own prefix length. The calculator sorts your rows by hosts needed, largest first, and keeps ties in the order you entered them. Each subnet gets the smallest block whose usable count (2^(32 - prefix) - 2) covers the need, and the block is placed at the next address that is a multiple of its own size.
For 192.168.1.0/24 with the needs in the table above:
- Sales needs 100 hosts: the smallest block with enough usable addresses is a /25 (126 usable), placed at 192.168.1.0.
- Staff needs 50 hosts: the smallest block with enough usable addresses is a /26 (62 usable), placed at 192.168.1.128.
- Guest needs 25 hosts: the smallest block with enough usable addresses is a /27 (30 usable), placed at 192.168.1.192.
- Printers needs 10 hosts: the smallest block with enough usable addresses is a /28 (14 usable), placed at 192.168.1.224.
- WAN link needs 2 hosts: the smallest block with enough usable addresses is a /30 (2 usable), placed at 192.168.1.240.
A need of 1 host gets a /32 host route, and a need of 2 hosts gets a /30, or a /31 when Use /31 for 2-host links is ticked. To check a prefix size, see the subnet mask cheat sheet, and to turn a start and end address into blocks, use IP range to CIDR.
A second example
10.0.0.0/22 holds 1,024 addresses. A plan for 500, 200 and 60 hosts fits with room to spare:
| Name | Hosts needed | Subnet | Mask | Usable | First | Last | Broadcast |
|---|---|---|---|---|---|---|---|
| A | 500 | 10.0.0.0/23 | 255.255.254.0 | 510 | 10.0.0.1 | 10.0.1.254 | 10.0.1.255 |
| B | 200 | 10.0.2.0/24 | 255.255.255.0 | 254 | 10.0.2.1 | 10.0.2.254 | 10.0.2.255 |
| C | 60 | 10.0.3.0/26 | 255.255.255.192 | 62 | 10.0.3.1 | 10.0.3.62 | 10.0.3.63 |
The free space is 10.0.3.64/26, 10.0.3.128/25, which is 192 addresses. Keep it for later subnets. Use the CIDR calculator to see the range of any block in the plan.
When the plan does not fit
192.168.1.0/26 holds 62 usable hosts. With needs of 40 and 30 hosts, the first subnet takes the whole /26 and the second has nowhere to go, so the calculator stops at that row and shows "Not enough space in 192.168.1.0/26 for B." Any rows after it are listed as Not allocated.
To fix a plan that does not fit, use a larger network, such as a /25, or lower the host counts. The tool handles up to 50 subnets.
Frequently asked questions
What is VLSM?
VLSM, variable length subnet masking, means using different prefix lengths inside one network so each subnet is the right size. Instead of giving every group a /26, Sales gets a /25 for 100 hosts and a link gets a /30 for 2. The result wastes fewer addresses, and the blocks still do not overlap.
How do I subnet 192.168.1.0/24 for 100, 50, 25, 10 and 2 hosts?
Allocate the largest first. 100 hosts gets 192.168.1.0/25, 50 gets 192.168.1.128/26, 25 gets 192.168.1.192/27, 10 gets 192.168.1.224/28 and 2 gets 192.168.1.240/30. That leaves 12 addresses free: 192.168.1.244/30 and 192.168.1.248/29. The table above fills in the masks, ranges and broadcast addresses.
Why does the calculator place the biggest subnet first?
Each block must start on a boundary that matches its size. Placing the biggest block first keeps every later, smaller block aligned and leaves one tidy free area at the end. If small blocks go first, gaps open up and a large block may no longer fit. The tool sorts your rows for you and keeps your names.
What does "Not enough space" mean?
It means the next subnet cannot fit in what is left of your network. For 192.168.1.0/26 with needs of 40 and 30 hosts, the first takes the whole /26, so the message reads "Not enough space in 192.168.1.0/26 for B." Choose a larger network, such as a /25, or lower the host counts.
What does "Use /31 for 2-host links" do?
It gives a two-host need a /31 instead of a /30. A /31 has 2 usable addresses and no network or broadcast address, so it uses half the space. In the example the WAN link gets 192.168.1.240/31 instead of 192.168.1.240/30. Turn it on only for point-to-point links whose equipment supports /31.
What happens to the addresses I do not use?
They appear as free space under the table and as the hatched part of the bar. For 10.0.0.0/22 with needs of 500, 200 and 60 hosts, the free space is 10.0.3.64/26 and 10.0.3.128/25, which is 192 addresses. You can keep that space for later subnets.