What is VLSM?
VLSM stands for Variable Length Subnet Mask. Instead of cutting a network into equal pieces, you give each subnet only the size it needs. A floor with 100 devices gets a /25, a floor with 50 gets a /26, and a small lab with 30 gets a /27. Whatever is left over stays free for later.
That saves a lot of addresses compared with giving every subnet the same size. The price is a little more planning, and that is the part this calculator does for you. If you would rather have equal subnets, use the FLSM Calculator.
How to use this VLSM calculator
Type any address from the network into IP Address, then set the Subnet Mask or drag the CIDR slider. You don't need the exact network address. If you type 192.168.1.0 with /21, the calculator starts from 192.168.0.0/21 and tells you so. The mask has to be /30 or shorter.
Type the numbers into Hosts per Subnet, separated by commas, for example 100,50,30. Spaces are fine. No. of Subnets counts the numbers for you, so you can't edit it. Every number must be 1 or more.
The result appears below the form (pressing Enter works too). From then on it follows your changes, so you can add a number to the list and watch the tables update. If something is wrong, a red message under the box says what to fix.
The Variable Length Subnetting table lists your subnets, largest first. The Free/Unused IP Network table under it shows the space that is still free. Tick or untick boxes in Show Columns to choose what you see. On a phone or tablet that row slides sideways. The Network Address column is always shown.
Copy puts the tables on your clipboard and Download saves them as a CSV file. Both include the used and the free blocks, with a Status column, and only the columns you ticked. Clear All puts everything back to the starting values and hides the result.
Common slip-ups
- I asked for 100 hosts and got 126. Sizes come in powers of 2, so 100 hosts rounds up to a
/25, which holds 126. - My list came out in a different order. The subnets are placed largest first so that no space is lost. The names follow that order.
- "These subnets need … addresses". The network is too small for the list. Use a shorter mask or lower some of the numbers.
- "Too small to split". A
/31or/32can't hold subnets with hosts in them.
How VLSM subnetting works
Every subnet is sized on its own, and then the subnets are placed one after the other, starting at the beginning of the network.
The steps are always the same:
- Work out the block size for every request.
- Sort the blocks from largest to smallest.
- Place the first block at the start of the network and each next block right after the one before it.
- Cut what is left over into the largest blocks that fit. Those are the free blocks.
Largest first matters because a block has to start on a multiple of its own size. A /25 can start at .0 or .128 but never at .64. Placing the big blocks first keeps every start address valid and leaves no holes.
Example: 192.168.1.0/21 with hosts 100, 50, 30
- The network address is
192.168.0.0/21, which has 2,048 addresses. - 100 hosts need 102 addresses, so the block is 128, a
/25. 50 hosts need 52, so 64, a/26. 30 hosts need 32, so 32, a/27. - The three subnets use 224 addresses, one after the other.
- The other 1,824 addresses are free. They are cut into 4 blocks, listed in address order.
Variable Length Subnetting
| Subnet Name | Network Address | First Usable IP | Last Usable IP | Broadcast Address | Total Usable Hosts | Total Available Hosts | Subnet Mask | Wildcard Mask |
|---|---|---|---|---|---|---|---|---|
| Subnet 1 | 192.168.0.0/25 | 192.168.0.1 | 192.168.0.126 | 192.168.0.127 | 126 | 128 | 255.255.255.128 | 0.0.0.127 |
| Subnet 2 | 192.168.0.128/26 | 192.168.0.129 | 192.168.0.190 | 192.168.0.191 | 62 | 64 | 255.255.255.192 | 0.0.0.63 |
| Subnet 3 | 192.168.0.192/27 | 192.168.0.193 | 192.168.0.222 | 192.168.0.223 | 30 | 32 | 255.255.255.224 | 0.0.0.31 |
Free/Unused IP Network
| Subnet Name | Network Address | First Usable IP | Last Usable IP | Broadcast Address | Total Usable Hosts | Total Available Hosts | Subnet Mask | Wildcard Mask |
|---|---|---|---|---|---|---|---|---|
| Subnet 4 | 192.168.0.224/27 | 192.168.0.225 | 192.168.0.254 | 192.168.0.255 | 30 | 32 | 255.255.255.224 | 0.0.0.31 |
| Subnet 5 | 192.168.1.0/24 | 192.168.1.1 | 192.168.1.254 | 192.168.1.255 | 254 | 256 | 255.255.255.0 | 0.0.0.255 |
| Subnet 6 | 192.168.2.0/23 | 192.168.2.1 | 192.168.3.254 | 192.168.3.255 | 510 | 512 | 255.255.254.0 | 0.0.1.255 |
| Subnet 7 | 192.168.4.0/22 | 192.168.4.1 | 192.168.7.254 | 192.168.7.255 | 1,022 | 1,024 | 255.255.252.0 | 0.0.3.255 |
Which subnet size does a request need?
A quick reference. Find the number of hosts you need in the last column to see the prefix it gets.
| Prefix | Subnet mask | Addresses | Usable hosts | Hosts you can ask for |
|---|---|---|---|---|
| /30 | 255.255.255.252 | 4 | 2 | 1 – 2 |
| /29 | 255.255.255.248 | 8 | 6 | 3 – 6 |
| /28 | 255.255.255.240 | 16 | 14 | 7 – 14 |
| /27 | 255.255.255.224 | 32 | 30 | 15 – 30 |
| /26 | 255.255.255.192 | 64 | 62 | 31 – 62 |
| /25 | 255.255.255.128 | 128 | 126 | 63 – 126 |
| /24 | 255.255.255.0 | 256 | 254 | 127 – 254 |
| /23 | 255.255.254.0 | 512 | 510 | 255 – 510 |
| /22 | 255.255.252.0 | 1,024 | 1,022 | 511 – 1,022 |
| /21 | 255.255.248.0 | 2,048 | 2,046 | 1,023 – 2,046 |
| /20 | 255.255.240.0 | 4,096 | 4,094 | 2,047 – 4,094 |
Where VLSM works well
Use VLSM when your groups are different sizes: a head office with hundreds of devices, branch offices with a few dozen, and point-to-point links between routers that need only two addresses. It is also how most real networks are planned, because addresses are limited and growth is hard to predict.
A good habit is to leave some room. Ask for a few more hosts than you have today, and keep the free blocks for new subnets. To look closer at one subnet, put its network address and mask into the IPv4 Subnet Calculator.