VLSM Calculator
Enter a base network and how many hosts each subnet needs — the calculator allocates them using Variable Length Subnet Masking, largest first, with no wasted addresses. Everything runs in your browser.
Try it
What VLSM actually solves
Classic subnetting splits a network into equal-sized pieces. That is wasteful, and the waste is usually enormous.
Suppose you have 192.168.1.0/24 and you need subnets for 60 hosts, 28 hosts, 12 hosts, and a 2-host router-to-router link. Split the /24 into four equal /26s and every subnet gets 62 usable addresses — so the point-to-point link, which needs two, is handed 62. You have thrown away 60 addresses on one link.
VLSM lets each subnet be exactly as big as it needs to be:
| Requirement | Prefix | Usable hosts | Waste |
|---|---|---|---|
| 60 hosts | /26 | 62 | 2 |
| 28 hosts | /27 | 30 | 2 |
| 12 hosts | /28 | 14 | 2 |
| 2 hosts (P2P link) | /30 | 2 | 0 |
All four fit inside the same /24, with room to spare. That is the whole point.
The one rule that makes VLSM work
Always allocate the largest subnet first.
This is not a style preference — it is what makes the allocation fit. Subnets must start on a boundary that is a multiple of their own block size. If you allocate a small subnet first, it can land in the middle of the space a larger subnet needs, and the larger one then has nowhere to go, even though there are technically enough addresses left.
Sort by hosts needed, descending. Allocate from the top. That is the algorithm, and it is exactly what the calculator above does.
Doing it by hand for the exam
The CCNA exam will ask you to do this on paper. The method:
- Sort requirements largest → smallest.
- For each, find the smallest prefix that fits: you need hosts + 2 addresses, rounded up to a power of 2. (60 hosts → 62 needed → 64 addresses → /26.)
- Allocate from the start of the remaining space.
- Move the pointer to the next free address and repeat.
Practise until it is automatic — it is one of the most reliably examined skills. See VLSM explained and the complete subnetting guide.
Frequently asked questions
What is VLSM?
Variable Length Subnet Masking — subnetting where each subnet gets a prefix sized to its actual need, rather than splitting a network into equal-sized pieces. It eliminates wasted addresses.
Why must I allocate the largest subnet first in VLSM?
Because subnets must start on a boundary that is a multiple of their own block size. Allocating a small subnet first can block the boundary a larger subnet needs, even when enough total addresses remain.
What prefix should I use for a router-to-router link?
A /30, which gives exactly 2 usable hosts. On modern equipment a /31 also works for point-to-point links (RFC 3021) and wastes nothing at all.
Is this VLSM calculator free?
Yes. It is free, needs no signup, and runs entirely in your browser — nothing is sent to a server.
Sources & further reading
The standards and official documentation behind this page. We link them so you can verify anything here for yourself.
Related articles
Not sure about your next career step?
Talk it through with a counsellor at Attila Technologies — 20+ years placing students into networking jobs across Gujarat. Free session, no obligation.