
What Is VLSM?
VLSM, or Variable Length Subnet Mask, is a way of dividing a network into subnets of different sizes so that IP addresses are not wasted. Instead of cutting a network into equal pieces, VLSM lets you give a large department a large subnet, a small team a small one, and a point-to-point link just two addresses. For anyone studying networking, preparing for a certification exam, or designing a real network, VLSM is the technique that turns subnetting from a textbook exercise into a practical skill.
In this guide, you will learn what VLSM is, how it differs from fixed-length subnetting, how to work out subnet sizes, and how to apply it in a worked example. No advanced mathematics is needed — just powers of two and a little patience.
What Is VLSM?
VLSM stands for Variable Length Subnet Mask. It is a subnetting technique in which different subnets in the same network use different subnet masks — and therefore have different sizes. A /26 subnet has 62 usable host addresses, a /28 has 14, and a /30 has just 2. With VLSM, each subnet gets a mask that matches the number of hosts it actually needs.
The idea only works with classless addressing, where the boundary between the network part and the host part of an address can fall anywhere. That is the world of CIDR (Classless Inter-Domain Routing), in which an address is written with a prefix length, such as 192.168.1.0/24. What is an IP address? In short, it is a 32-bit number that identifies a device on a network, and the subnet mask says how much of that number identifies the network and how much identifies the device.
VLSM vs. Fixed-Length Subnetting (FLSM)
Before VLSM, networks used fixed-length subnetting (FLSM): every subnet in a network had the same size. That is simple, but wasteful.
Suppose you have the network 192.168.1.0/24 — 256 addresses — and you need subnets for 100, 50, 20, and 5 hosts. With FLSM, the largest requirement decides the size for all of them. A subnet for 100 hosts needs at least 128 addresses, so every subnet is carved into /25 blocks of 128 addresses. The subnet for 5 hosts would still get 128 addresses, wasting more than 120 of them, and you would only get two subnets out of the whole network.
With VLSM, each requirement gets a right-sized subnet: a /25 for the 100 hosts, a /26 for the 50, a /27 for the 20, and a /29 for the 5. The same 256 addresses now serve all four groups, with room to spare. That is the whole point of VLSM: fit the subnet to the need.
How VLSM Works: The Maths
Every subnet calculation comes down to powers of two. Each host bit doubles the number of addresses in a subnet, and two addresses in every subnet are reserved: the network address and the broadcast address.
- A /24 network has 8 host bits: 2^8 = 256 addresses, 254 usable.
- A /25 has 7 host bits: 128 addresses, 126 usable.
- A /26 has 6 host bits: 64 addresses, 62 usable.
- A /27 has 5 host bits: 32 addresses, 30 usable.
- A /28 has 4 host bits: 16 addresses, 14 usable.
- A /29 has 3 host bits: 8 addresses, 6 usable.
- A /30 has 2 host bits: 4 addresses, 2 usable — the standard size for a point-to-point link between two routers.
To size a subnet, find the smallest power of two that covers the hosts you need plus the two reserved addresses. For 50 hosts, you need at least 52 addresses, so the next power of two is 64 — a /26, with 62 usable addresses. For 12 hosts, you need at least 14 addresses, so the next power of two is 16 — a /28, with 14 usable addresses.
A subnet is a smaller network carved out of a larger one. VLSM is simply the practice of carving subnets of different sizes from the same parent network, in order, largest first.
Worked Example: Subnetting 192.168.1.0/24 with VLSM
Here is a complete example. A small company has the network 192.168.1.0/24 and needs four subnets: Sales with 50 hosts, Engineering with 25 hosts, HR with 12 hosts, and a WAN link between two routers with 2 hosts.
Step 1: Sort the requirements, largest first
Always start with the largest subnet. If you start small, you can end up with the larger subnets not fitting into the remaining space. The order is Sales (50), Engineering (25), HR (12), WAN link (2).
Step 2: Sales — 50 hosts
50 hosts need 52 addresses, so the next power of two is 64: a /26 subnet. The first available block is 192.168.1.0/26. It covers 192.168.1.0 to 192.168.1.63, with usable addresses from 192.168.1.1 to 192.168.1.62. The network address is 192.168.1.0 and the broadcast address is 192.168.1.63.
Step 3: Engineering — 25 hosts
25 hosts need 27 addresses, so the next power of two is 32: a /27 subnet. The next free block starts at 192.168.1.64, so Engineering gets 192.168.1.64/27, covering 192.168.1.64 to 192.168.1.95, with usable addresses from 192.168.1.65 to 192.168.1.94.
Step 4: HR — 12 hosts
12 hosts need 14 addresses, so the next power of two is 16: a /28 subnet. The next free block starts at 192.168.1.96, so HR gets 192.168.1.96/28, covering 192.168.1.96 to 192.168.1.111, with usable addresses from 192.168.1.97 to 192.168.1.110.
Step 5: WAN link — 2 hosts
A point-to-point link needs just 2 usable addresses, so a /30 is perfect. The next free block starts at 192.168.1.112, so the WAN link gets 192.168.1.112/30, covering 192.168.1.112 to 192.168.1.115, with usable addresses 192.168.1.113 and 192.168.1.114.
The four subnets together use addresses 192.168.1.0 to 192.168.1.115. The remaining space, 192.168.1.116 to 192.168.1.255, is still free for future growth — with FLSM, it would have been wasted.
Benefits of VLSM
- It saves IP addresses. Small subnets stop wasting addresses on links and teams that need only a few hosts, which matters most when address space is limited.
- It matches real networks. Real organisations have departments of very different sizes, and VLSM reflects that instead of forcing every group into the same size.
- It supports route summarisation. Because VLSM subnets are carved from one parent network, routers can often advertise a single summary route for the whole block, keeping routing tables smaller.
- It is the standard for modern networks. Classless routing protocols and modern network design assume VLSM; it is not an optional extra.
Limitations and Pitfalls
VLSM is not free of trade-offs. First, it is more complex than fixed-length subnetting. A mistake in one calculation can create overlapping subnets, where two subnets claim the same addresses, and the network will behave unpredictably. Second, it needs classless routing protocols: older classful protocols such as RIPv1 do not advertise subnet masks, so they cannot support VLSM. Modern protocols such as OSPF, EIGRP, and RIPv2 do. Third, VLSM designs need to leave room for growth. A subnet sized exactly for today’s headcount will break the day a department hires one more person, so most designers add a margin of 10 to 20 percent.
Design Tips for Using VLSM
- Always allocate largest first. This keeps the address space tidy and avoids fragmentation.
- Leave growth space. Size each subnet for the hosts you expect in the next year or two, not just today.
- Document every subnet. Record the network address, mask, range, and purpose of each subnet in an IP address management (IPAM) tool or a simple spreadsheet.
- Reserve space for infrastructure. Keep blocks aside for servers, printers, management interfaces, and future sites.
- Use /30 (or /31) for point-to-point links. Two routers on a link need only two addresses; giving them a /24 is a waste.
- Check for overlap before deploying. A subnet calculator or a quick check of the ranges will catch overlapping subnets before they reach production.
Network Address Translation (NAT) is a separate technique that lets private addresses reach the internet, but the same discipline applies: plan your addressing, document it, and leave room to grow.
Frequently Asked Questions
What does VLSM stand for?
VLSM stands for Variable Length Subnet Mask. It is a subnetting method in which different subnets in the same network use different subnet masks, so each subnet can be a different size.
What is the difference between VLSM and FLSM?
FLSM (Fixed Length Subnet Mask) gives every subnet the same size, which wastes addresses when requirements differ. VLSM gives each subnet a size matched to its needs, so address space is used efficiently.
Which routing protocols support VLSM?
Classless routing protocols support VLSM, including RIPv2, EIGRP, and OSPF. Classful protocols such as RIPv1 do not advertise subnet masks and cannot support it.
When should I use VLSM?
Use VLSM whenever a network has subnets of different sizes, when IP address space is limited, or when you are designing a network from scratch. For a network where every subnet genuinely needs the same number of hosts, FLSM is simpler and perfectly fine.
Conclusion
VLSM is one of those ideas that looks complicated until you work through one example, and then it becomes obvious. Fixed-length subnetting wastes addresses; variable-length subnetting fits each subnet to its need, largest first, using the smallest power of two that covers the hosts plus the network and broadcast addresses. Learn the powers of two, practise the worked example above with your own numbers, and you will be able to design efficient, documented, and scalable networks — and answer the VLSM questions on any networking exam with confidence.


