
How to Use the VLSM Calculator

- Enter the base network you were given in CIDR form, such as 192.168.10.0/24.
- List each subnet on its own line with a name and the hosts it needs, like Sales 100.
- Optionally add growth headroom so every subnet has room for future devices.
- Check that every subnet fits, then read the allocation table and free blocks below.
Type the base network you have been given in CIDR form, such as 192.168.10.0/24. In the box below, list each subnet you need on its own line with a name and the number of hosts it must hold, for example Sales 100. Order does not matter. The calculator sizes each subnet, sorts them largest first and places them one after another from the start of the base network.
The result panel shows whether everything fits, how much of the address space is used and which free blocks remain for later. The full allocation table sits under the tool, and you can copy it or download it as a CSV for your documentation. Add a growth headroom percentage to size each subnet for future devices, and tick the /31 option to give point-to-point router links a /31 instead of a /30.
How VLSM Sizing Works
Variable length subnet masking lets each subnet have its own prefix length, so a link between two routers does not waste a block the size of an office LAN. Each subnet gets the smallest power-of-two block whose usable addresses cover the hosts it needs. Two addresses in every block are reserved: the network address and the broadcast address.
prefix = 32 − k usable hosts = 2k − 2
hosts needed with headroom = hosts + ceil(hosts × growth%)
Allocating the largest blocks first is what keeps the plan gap free. Every block size divides the size of the block before it, so each new subnet starts exactly on a boundary of its own size. Allocating small subnets first would leave misaligned holes that larger blocks cannot use.
Worked Example
The default plan splits 192.168.10.0/24 (256 addresses) into six subnets. Sales needs 100 hosts: 27 − 2 = 126 is the first size that fits, so it gets a /25. Engineering needs 50, which fits in a /26 with 62 usable hosts. Support (25) takes a /27, Management (10) a /28, and each WAN link (2) a /30.
| Subnet | Hosts | Network | Usable range | Broadcast |
|---|---|---|---|---|
| Sales | 100 | 192.168.10.0/25 | .1 to .126 | .127 |
| Engineering | 50 | 192.168.10.128/26 | .129 to .190 | .191 |
| Support | 25 | 192.168.10.192/27 | .193 to .222 | .223 |
| Management | 10 | 192.168.10.224/28 | .225 to .238 | .239 |
| WAN A | 2 | 192.168.10.240/30 | .241 to .242 | .243 |
| WAN B | 2 | 192.168.10.244/30 | .245 to .246 | .247 |
The six blocks use 248 of 256 addresses, leaving 192.168.10.248/29 free. The plan asks for 189 hosts and provides 236 usable addresses, a host efficiency of 80.1%. We checked every network and broadcast address with Python’s ipaddress module.
When the Address Space Runs Out
If the blocks add up to more than the base network holds, the calculator stops and says how many addresses the plan needs, which subnet is the first that does not fit, and the smallest base prefix that would hold everything. Try the same six subnets in 192.168.10.0/25: they need 248 addresses but a /25 has only 128, so you need a /24. You can also lower a host count just below a power of two boundary. A subnet of 130 hosts needs a /24, while 126 fits a /25.
Planning Tips
- Count every address. Include the default gateway, switches, printers and access points, not only user devices.
- Leave room to grow. A 20% to 30% headroom avoids renumbering when a team expands.
- Keep links small. RFC 3021 allows /31 networks on point-to-point links, saving two addresses per link compared with a /30.
- Keep free blocks together. The largest-first order leaves the remaining space as a few large aligned blocks you can assign later.
The rules for classless prefixes are set out in RFC 4632, and private ranges for internal networks are listed in RFC 1918. To inspect a single subnet in detail, use the IP Subnet Calculator.
Frequently asked questions
What is VLSM in networking?
VLSM, or variable length subnet masking, divides one network into subnets of different sizes. Each subnet gets a prefix that matches its host count, so small router links do not waste the address space a large LAN needs.
Why are VLSM subnets allocated largest first?
Block sizes are powers of two, so placing the largest blocks first keeps every later block aligned on its own boundary. Allocating small subnets first leaves gaps that larger subnets cannot use, wasting addresses.
How many hosts fit in a /26 subnet?
A /26 contains 64 addresses. Two are reserved for the network and broadcast addresses, so 62 hosts can be assigned. The next size down, a /27, holds 30 usable hosts.
What is the difference between FLSM and VLSM?
Fixed length subnet masking gives every subnet the same prefix, sized for the largest one. Variable length subnet masking gives each subnet its own prefix, which saves addresses when subnet sizes differ a lot.
Should I use /30 or /31 for router links?
Both give two usable addresses. A /31, allowed by RFC 3021, uses half the space because it has no network or broadcast address. Most modern routers support it, but check older equipment first.
What happens if my subnets do not fit?
The calculator shows an error with the total addresses needed, the first subnet that does not fit and the smallest base prefix that would work. Request a larger block or reduce host counts.