Philippines ยท Science & Engineering

VLSM Calculator

For example 192.168.1.0/24 or 10.0.0.0/16.
Subnets required โ€” enter the number of usable hosts each needs
Allocation—

Enter a base network in CIDR form and the host requirement for each subnet. The calculator allocates largest-first โ€” which is what makes VLSM work โ€” and shows the network, usable range, broadcast and wasted addresses for every block.

How does VLSM subnetting work?

VLSM assigns each subnet only the address space it needs, rather than splitting a network into equal blocks. You sort requirements from largest to smallest, round each up to the next power of two after adding two for the network and broadcast addresses, and allocate blocks in that order so each starts on a boundary that is a multiple of its own size.

How to use this calculator

  1. Enter the base networkIn CIDR notation โ€” address and prefix. The calculator normalises whatever you enter to the actual network address, so 192.168.1.37/24 becomes 192.168.1.0/24.
  2. Enter usable hosts, not total addressesEnter the number of devices that need an address. The calculator adds two for the network and broadcast addresses itself, which is the step most often forgotten by hand.
  3. Do not sort them yourselfEnter subnets in any order. The calculator sorts largest-first before allocating, because that ordering is what makes VLSM work at all.
  4. Read the wasted columnIt shows how many usable addresses each block has beyond what you asked for. Large waste on a small subnet usually means the requirement sits just above a power of two.

Why the largest subnet has to go first

This is the rule that makes VLSM different from ordinary subnetting, and it is the one that trips people up in the CCNA exam.

Every subnet must begin on a boundary that is a multiple of its own block size. A /26 block holds 64 addresses, so it can only start at .0, .64, .128 or .192. It cannot start at .32, even if .32 happens to be free.

Allocate smallest-first and you break that rule immediately. Give a 10-host subnet the first 16 addresses, and the next free address is .16. A 128-address block cannot start at .16 โ€” the next valid boundary is .128, so everything from .16 to .127 is stranded. You have wasted 112 addresses to save none.

Allocate largest-first and the boundaries fall into place automatically. A 128-block starts at .0 and ends at .127. The next free address is .128, which is a valid boundary for a 64-block. That ends at .191, and .192 is a valid boundary for a 32-block. Each block leaves the cursor on a boundary the next-smaller block can use.

That is the whole trick, and it is why the rule is stated as an ordering rather than as arithmetic. The arithmetic is trivial; the ordering is what makes it fit.

Formulaeach block must start at an address that is a multiple of its own size

Worked example: 192.168.1.0/24 across four departments

Requirements of 100, 50, 25 and 10 hosts, already in descending order.

Sales needs 100 hosts. Add two for network and broadcast: 102. The next power of two is 128, so this is a /25 โ€” 32 minus 7 host bits. It takes 192.168.1.0/25, usable range .1 to .126, broadcast .127. Usable addresses: 126, so 26 are wasted.

Engineering needs 50. Plus two is 52, next power of two is 64, a /26. It starts at .128, which is a multiple of 64. Range .129 to .190, broadcast .191. Usable 62, wasted 12.

Admin needs 25. Plus two is 27, next power of two is 32, a /27. Starts at .192, range .193 to .222, broadcast .223. Usable 30, wasted 5.

Servers needs 10. Plus two is 12, next power of two is 16, a /28. Starts at .224, range .225 to .238, broadcast .239. Usable 14, wasted 4.

Total allocated: 128 + 64 + 32 + 16 = 240 addresses. Sixteen remain free from 192.168.1.240, which is exactly one more /28 if a fifth department appears.

With classful subnetting into four equal blocks you would get four /26s of 64 addresses each. Sales, needing 100, would not fit at all. That is the case for VLSM in one sentence.

Block size reference

PrefixBlock sizeUsable hostsMask
/24256254255.255.255.0
/25128126255.255.255.128
/266462255.255.255.192
/273230255.255.255.224
/281614255.255.255.240
/2986255.255.255.248
/3042255.255.255.252

The /30 row is worth memorising separately. Two usable addresses is exactly what a point-to-point link between two routers needs, and using anything larger for one wastes address space at every hop. Some designs use /31 links, which dispense with the network and broadcast addresses entirely under RFC 3021, though not every platform supports them.

The mistakes that cost marks and cause outages

Forgetting the plus two is the most common error, and it hides until deployment. A requirement for exactly 30 hosts needs 32 addresses, which means a /27 gives you 30 usable โ€” just enough. A requirement for 31 hosts needs 33, which pushes you to a /26 and 62 usable. The jump is not gradual, and a subnet sized from the host count alone will be one device short.

Sizing for today rather than for growth is the operational version of the same mistake. A subnet at 95% capacity cannot be expanded in place โ€” the next block is already allocated to something else. Renumbering a live subnet is disruptive in a way that allocating a slightly larger block on day one is not. Sizing to roughly double the current requirement is a common convention.

Allocating in the order the requirements arrived, rather than by size, produces a design that looks fine on paper and fails to fit. Always sort first.

Overlapping ranges arise when blocks are placed by hand without checking boundaries. Two subnets whose ranges intersect will produce routing behaviour that is difficult to diagnose because it is intermittent โ€” traffic reaches the wrong destination only for some addresses.

And summarisation is worth thinking about at design time rather than after. Allocating contiguous blocks to related subnets means they can be summarised into a single route advertisement later. Scattering them means they cannot, and the routing table grows for no benefit.

IPv6 removes the address scarcity that motivates VLSM but not the design discipline. The convention there is a /64 for every subnet regardless of size, with the hierarchy carried in the prefix rather than squeezed out of the host bits.

Assumptions and limitations

  • IPv4 only โ€” IPv6 subnetting follows different conventions
  • Reserves two addresses per subnet for network and broadcast, so does not model RFC 3021 /31 point-to-point links
  • Allocates contiguously from the start of the base network with no reserved gaps
  • Does not check whether the base network overlaps anything already deployed
  • Handles up to six subnets in one pass โ€” larger designs are usually built hierarchically anyway
  • Does not generate router configuration or check for summarisation opportunities
  • Assumes classless routing throughout, which every modern platform supports

Questions people ask about this in Philippines

How does VLSM subnetting work?

Each subnet gets only the address space it needs rather than an equal share. Sort requirements largest to smallest, add two hosts for the network and broadcast addresses, round up to the next power of two, and allocate in that order.

The ordering is what matters โ€” each block must start on a multiple of its own size.

Why must I subnet largest first?

Because every block has to start at an address that is a multiple of its own size. Allocate a small block first and the next free address will not be on a valid boundary for a larger one, stranding everything in between.

Largest-first leaves the cursor on a usable boundary every time.

Why add two to the host count?

The first address in a block is the network address and the last is the broadcast address. Neither can be assigned to a device.

A subnet needing 30 hosts needs 32 addresses; one needing 31 needs a block of 64.

What is the difference between VLSM and CIDR?

VLSM is about splitting a network internally into different-sized subnets. CIDR is about aggregating networks for routing between organisations.

They use the same prefix arithmetic in opposite directions โ€” one divides, the other summarises.

How many hosts does a /26 give me?

Sixty-two. A /26 is a block of 64 addresses, less the network and broadcast addresses.

The general rule is 2^(32 โˆ’ prefix) โˆ’ 2.

Should I size subnets for current or future needs?

Future. A subnet cannot be expanded in place once the adjacent block is allocated, and renumbering a live subnet is disruptive.

Sizing to roughly double the current requirement is a common convention.

Method, source and review date

How it is worked out
Classless Inter-Domain Routing with largest-first allocation
Formula used
block size = 2^โŒˆlogโ‚‚(hosts + 2)โŒ‰; prefix = 32 โˆ’ logโ‚‚(block size)
Checked against
RFC 1878 / RFC 4632
Last reviewed
Confidence
High

Spotted a figure that has moved, or a formula you can show is wrong? Tell us โ€” send a correction. Fixes to rates and formulas are treated as urgent.

Disclaimer

This calculator gives an estimate for guidance only. Check the figures against your own measurements or paperwork before you commit money to them.