VLSM Calculator
Enter a parent network and the number of hosts each subnet needs. The calculator places the blocks from the largest down and gives you a VLSM subnet plan.
What VLSM is
VLSM (variable length subnet masking) splits one parent network into subnets of different sizes. When subnets need different numbers of hosts, making them all the same size (the same prefix length) wastes addresses. Changing the prefix length to fit the hosts needed uses the addresses efficiently. A table of the number of addresses for each IPv4 prefix length is given in RFC 1878 (an informational document).
The allocation procedure (the usual one)
- Turn each request into the smallest block that has enough hosts. For /30 and shorter prefixes, usable hosts = total addresses − 2 (the network and broadcast addresses are not usable). For example, 100 hosts need a /25 (126 hosts) and 50 hosts need a /26 (62 hosts).
- Sort the blocks from the largest (most hosts) down. Blocks of the same size keep the order of the rows you entered.
- Place them one after another from the start of the parent network.
This is the common way of doing it and is not defined by a standard. CIDR blocks are powers of two in size (RFC 4632), and the start of each block is an address that is a multiple of the block size (a network boundary). Placing the largest first keeps the boundaries aligned (the tool also checks that they are).
When there are not enough addresses
- If the blocks requested add up to more than the parent network holds, addresses are short. The tool shows how many are missing and which rows could not be allocated.
- If, while placing from the largest down, a block no longer fits in the space left, that row and the rows after it cannot be allocated (nothing is left, so smaller blocks do not fit either). A row that asks for a block larger than the parent network fails on its own, and smaller blocks can still be placed.
- If the total is exactly the size of the parent network, it is full, not short (0 addresses are left).
/31 and /32
- Off (the default): the smallest subnet is a /30 (2 hosts). A need for 1 or 2 hosts both give a /30. /31 and /32 are not allocated.
- On: 1 host needed becomes a /32 (a single address, such as a loopback) and 2 hosts becomes a /31. 3 to 6 hosts need a /29 (a /30 holds only 2).
- /31: RFC 3021 describes using a 31-bit mask on point-to-point links, where both addresses are used as host addresses (there is no network or broadcast address). It is for one-to-one links such as router-to-router connections, not for LAN subnets.
- /32: a single address that names one host (RFC 4632 treats it as a block of one address). A statement about the use of /32 in an RFC could not be confirmed.
- The parent network's prefix length can be /0 to /30.
Example
Split the parent network 192.168.0.0/24 into four subnets of 100, 50, 25 and 10 hosts (with /31 and /32 off):
| Order | Hosts needed | Allocation | Usable addresses |
|---|---|---|---|
| 1 | 100 | 192.168.0.0/25 | 192.168.0.1 to 192.168.0.126 |
| 2 | 50 | 192.168.0.128/26 | 192.168.0.129 to 192.168.0.190 |
| 3 | 25 | 192.168.0.192/27 | 192.168.0.193 to 192.168.0.222 |
| 4 | 10 | 192.168.0.224/28 | 192.168.0.225 to 192.168.0.238 |
The blocks total 128 + 64 + 32 + 16 = 240 addresses, and 16 addresses (from 192.168.0.240) are unallocated.
An example with a shortage: asking 192.168.0.0/24 for 126, 126 and 2 hosts needs two /25 blocks (128 addresses each), which fill the parent's 256 addresses, so the third request (2 hosts, a /30 of 4 addresses) cannot be allocated (4 addresses short).
Notes
- Enter the parent network in IPv4 CIDR notation (octets with a leading zero are not accepted, as in the IPv4 Subnet Calculator). If the address has a non-zero host part, it is changed to the network address before the calculation.
- Hosts needed is a whole number from 1 to 4,294,967,294. Include gateways and future growth in the hosts you enter.
- For one address and prefix, use the IPv4 Subnet Calculator; for IPv6, the IPv6 Subnet Calculator; and for base conversion, the Number Base Converter.
Sources and checks
The RFC statements above were checked in the RFCs when the Japanese version of this tool was made (October 29, 2026): RFC 3021 (section 2.1, 31-bit prefixes on point-to-point links), RFC 4632 (CIDR; prefixes stand for power-of-two blocks) and RFC 1878 (an informational table of subnet sizes). They were not checked again for this page. The "largest first" procedure is not defined by an RFC; it is the usual practice.
Frequently asked questions
What is VLSM?
A way of splitting one parent network into subnets of different sizes to fit the number of hosts each one needs.
Why allocate the largest first?
Placing the biggest blocks first keeps the start of every block on a network boundary (a multiple of the block size) and leaves few gaps. This is common practice, not a standard.
Can I use a /31 on a LAN?
RFC 3021 describes the use on point-to-point links. It does not specify use as a LAN subnet.
What happens if there are not enough addresses?
The tool compares the total of the blocks with the parent network, shows how many addresses are missing, and lists the rows that could not be allocated, with the reason.