VLSM Subnetting Guide: Variable Length Subnet Mask Explained with Examples

VLSM Subnetting Guide: Variable Length Subnet Mask Explained with Examples

Published on June 3, 2026 · Niwo

VLSM Subnetting Guide: Variable Length Subnet Mask Explained with Examples

What is VLSM?

Variable Length Subnet Mask (VLSM) is an IP subnetting technique that allows network engineers to use different subnet mask lengths for different subnets within the same network. Instead of forcing every subnet to be the same size (as in classful or FLSM designs), VLSM tailors each subnet’s prefix length to match its actual host requirement.

VLSM is the practical implementation of Classless Inter-Domain Routing (CIDR), introduced by the IETF in 1993 through RFC 1518 and RFC 1519. CIDR replaced the rigid classful addressing system (Class A, B, C) and gave network administrators the freedom to divide IP blocks at arbitrary bit boundaries. VLSM is what you do inside your network with CIDR — the technique of carving a given block into variable-sized subnets.

Why standard subnetting wastes IPs

Before CIDR, subnetting was classful. A Class C network (/24) gave you 256 addresses. A Class B (/16) gave you 65,536. If your company needed 300 IPs, you had to take an entire Class B — wasting 65,236 addresses. Moving down, a Class C was too small for 300 hosts. This binary choice was the root cause of massive IPv4 address waste throughout the 1980s and early 1990s.

VLSM solved this by letting network engineers pick any prefix length between /0 and /32. Need 300 hosts? Use a /23 (510 usable addresses). Need 2 hosts for a WAN link? Use a /30 (2 usable addresses). Every subnet gets exactly what it needs — no more, no less.

CIDR foundation

CIDR notation — the familiar 192.168.1.0/24 format — is the language of VLSM. The number after the slash tells you how many bits belong to the network prefix. The remaining bits (32 minus the prefix) are host bits:

192.168.1.0/24  →  24 network bits  |  8 host bits  = 256 addresses
192.168.1.0/26  →  26 network bits  |  6 host bits  =  64 addresses
192.168.1.0/30  →  30 network bits  |  2 host bits  =   4 addresses

Each time you borrow one more bit from the host portion, you double the number of subnets and halve the number of addresses per subnet. This bit-level flexibility is the engine behind VLSM.

🧮 Try our VLSM Calculator to see CIDR prefix math in action — enter any base network and host requirements, and the tool generates an optimized plan instantly.


VLSM vs FLSM (Fixed Length Subnet Mask)

FLSM (Fixed Length Subnet Mask) divides a network into subnets of identical size. VLSM divides it into subnets of different sizes, each sized to match its host requirement. This single difference has massive implications for IP efficiency, scalability, and network design.

Key differences

AspectFLSMVLSM
Subnet sizesAll identicalVaries per subnet
IP efficiencyLow — wastes addresses on small subnetsHigh — each subnet sized to need
Routing protocol supportRIPv1 (classful only)RIPv2, OSPF, EIGRP, BGP, IS-IS
Configuration complexitySimple but wastefulRequires planning, vastly more efficient
Growth flexibilityPoor — must redesign for larger subnetsGood — gaps left for expansion
CIDR supportNoYes — foundation of CIDR
Exam relevanceCCNA fundamentalsCCNA core skill

Real-world example: the cost of FLSM

Consider a medium business with a 10.0.0.0/24 block (256 addresses) that needs three subnets:

  • Server farm: 100 hosts
  • Office LAN: 50 hosts
  • WAN link: 2 hosts

With FLSM: dividing the /24 into 3 equal subnets means you need 3 subnets. The closest power-of-2 for 3 subnets is 4, so each subnet gets 64 addresses (/26). The WAN link, needing only 2 addresses, is assigned a /26 with 62 usable addresses — 60 are wasted. Total waste: 128 addresses (the 4th unused subnet of 64, plus 60 on the WAN link, plus 14 on the office LAN, plus 14 on the server farm if it only uses 100 out of 62… wait, 62 < 100, so this doesn’t even work).

The FLSM trap: with 3 subnets, you’d pick /26 (64 addresses), but 64 < 100 — the server farm doesn’t fit. You’d have to jump to /25 (128 addresses) × 2 subnets, which still doesn’t give you 3 subnets. The only FLSM option is /24 divided into 4 × /26, but the server farm (100 hosts) barely fits in one /26 (62 usable addresses — it doesn’t fit). So FLSM forces you to use a larger block like 10.0.0.0/23 (512 addresses), of which you use maybe 30%.

With VLSM: you assign:

  • Server farm: /25 (126 usable addresses) — fits with room to grow
  • Office LAN: /26 (62 usable) — fits with margin
  • WAN link: /30 (2 usable) — zero waste

Total used: 128 + 64 + 4 = 196 addresses. Wasted: only 26 + 14 + 0 = 40 addresses. Efficiency: 79% vs 30% with FLSM.

This is the difference VLSM makes — it can mean the difference between fitting your entire network in a /24 versus needing a /23 or larger.


How VLSM Works

VLSM works by creating a subnet hierarchy where larger blocks are subdivided into progressively smaller blocks, always respecting the bit boundaries.

Subnet hierarchy

When you start with a base network like 10.0.0.0/24, VLSM treats it as a pool of addresses and allocates contiguous ranges of the required size. The key rule: once a block is assigned to a subnet, no other subnet may use those addresses.

The process follows a tree-like structure:

graph TB
    Root["10.0.0.0/24 (256 addresses)"]
    Root --> S1["/25 (128) — Largest subnet"]
    Root --> S2["/25 (128) — Reserved for future"]
    S1 --> M1["/26 (64) — Medium subnet"]
    S1 --> M2["/26 (64) — Medium subnet"]
    M1 --> SM1["/27 (32) — Small subnet"]
    M1 --> SM2["/27 (32) — Small subnet"]
    style Root fill:#1559ed,color:#fff
    style S2 fill:#e67e22,color:#fff

Each level of hierarchy corresponds to borrowing one additional bit. The beauty of this structure is that it naturally enables route summarization.

Route summarization

Because VLSM allocates addresses contiguously from the base address, all subnets derived from 10.0.0.0/24 share the same first 24 bits. A router can advertise a single /24 route instead of five individual subnet routes. This shrinks routing tables, reduces CPU load on routers, and speeds up convergence.

Consider this real scenario:

  • 10.0.0.0/25 (Server farm)
  • 10.0.128.0/26 (Office LAN)
  • 10.0.192.0/27 (Lab network)
  • 10.0.224.0/30 (WAN link)

Without VLSM summarization: 4 routes in the routing table. With VLSM summarization: 1 route10.0.0.0/24.

Contiguous addressing

VLSM works best when subnets are assigned contiguously — meaning subnet B starts at the address immediately after subnet A ends. Non-contiguous allocation (leaving random gaps) breaks the summarization chain and can fragment your address space. Always allocate from one end of the block moving forward; never skip around.

📐 Use our VLSM Calculator which enforces contiguous allocation automatically — it sorts subnets by size and assigns them sequentially without gaps.


VLSM Subnetting Step by Step

Here is the universal methodology for designing a VLSM plan. This process works for any network size, from a small office to a multi-site enterprise.

Step 1: Gather requirements

List every subnet you need and the number of usable host addresses each requires. Include all point-to-point links, management networks, guest VLANs, and future expansion.

Step 2: Sort by host count (descending)

Order all subnets from largest to smallest host requirement. This is the golden rule of VLSM: allocating large blocks first minimizes fragmentation and preserves contiguous space for smaller subnets that can fit into the remaining gaps.

Step 3: Calculate block size for each subnet

For each subnet, add 2 to the required host count (one for the network address, one for the broadcast address). Then round up to the next power of 2. This is your block size.

Required hosts+2 for overheadNext power of 2CIDR prefixUsable addresses
1–23–44/302
3–65–88/296
7–149–1616/2814
15–3017–3232/2730
31–6233–6464/2662
63–12665–128128/25126
127–254129–256256/24254

Step 4: Assign ranges sequentially

Starting from your base network address, assign each subnet its block in descending size order. The next subnet’s network address equals the previous subnet’s broadcast address plus 1.

Step 5: Document and verify

Record every assignment in a table (network address, CIDR, mask, usable range, broadcast). Verify that no ranges overlap and that all requirements are met. Leave documented gaps for future expansion.


Real-World VLSM Example

Let’s work through a substantial enterprise network. Your company has been assigned the block 172.16.0.0/22 (1024 addresses, 1022 usable) and needs to support the following departments and links:

DepartmentHosts requiredPurpose
Engineering300Workstations, servers, dev environments
Operations150Production floor, monitoring
Sales60CRM access, laptops, printers
Finance25Workstations, accounting systems
Guest WiFi10Visitor network (isolated)
WAN Link 12HQ to Data Center
WAN Link 22HQ to Branch Office
WAN Link 32HQ to Cloud VPN

Step 1: Add overhead and sort

SubnetReal need+2 overheadBlock size (next power of 2)CIDR
Engineering300302512/23
Operations150152256/24
Sales606264/26
Finance252732/27
Guest WiFi101216/28
WAN Link 1244/30
WAN Link 2244/30
WAN Link 3244/30

Sorted descending: Engineering (/23) → Operations (/24) → Sales (/26) → Finance (/27) → Guest WiFi (/28) → WAN Links 1–3 (/30 each).

Step 2: Allocate sequentially

Starting from 172.16.0.0/22:

1. Engineering — /23 (512 addresses)

  • Network: 172.16.0.0
  • Mask: 255.255.254.0
  • Range: 172.16.0.1 – 172.16.1.254
  • Broadcast: 172.16.1.255
  • Next subnet starts at: 172.16.2.0

2. Operations — /24 (256 addresses)

  • Network: 172.16.2.0
  • Mask: 255.255.255.0
  • Range: 172.16.2.1 – 172.16.2.254
  • Broadcast: 172.16.2.255
  • Next subnet starts at: 172.16.3.0

3. Sales — /26 (64 addresses)

  • Network: 172.16.3.0
  • Mask: 255.255.255.192
  • Range: 172.16.3.1 – 172.16.3.62
  • Broadcast: 172.16.3.63
  • Next subnet starts at: 172.16.3.64

4. Finance — /27 (32 addresses)

  • Network: 172.16.3.64
  • Mask: 255.255.255.224
  • Range: 172.16.3.65 – 172.16.3.94
  • Broadcast: 172.16.3.95
  • Next subnet starts at: 172.16.3.96

5. Guest WiFi — /28 (16 addresses)

  • Network: 172.16.3.96
  • Mask: 255.255.255.240
  • Range: 172.16.3.97 – 172.16.3.110
  • Broadcast: 172.16.3.111
  • Next subnet starts at: 172.16.3.112

6. WAN Link 1 — /30 (4 addresses)

  • Network: 172.16.3.112
  • Mask: 255.255.255.252
  • Range: 172.16.3.113 – 172.16.3.114
  • Broadcast: 172.16.3.115
  • Next subnet starts at: 172.16.3.116

7. WAN Link 2 — /30 (4 addresses)

  • Network: 172.16.3.116
  • Mask: 255.255.255.252
  • Range: 172.16.3.117 – 172.16.3.118
  • Broadcast: 172.16.3.119
  • Next subnet starts at: 172.16.3.120

8. WAN Link 3 — /30 (4 addresses)

  • Network: 172.16.3.120
  • Mask: 255.255.255.252
  • Range: 172.16.3.121 – 172.16.3.122
  • Broadcast: 172.16.3.123
  • Next subnet starts at: 172.16.3.124

Step 3: Analysis

  • Total addresses used: 512 + 256 + 64 + 32 + 16 + 4 + 4 + 4 = 892 of 1024
  • Addresses still available: 172.16.3.124 through 172.16.3.255 (132 addresses) for future subnets or expansion
  • Unused block: 172.16.4.0/22 through 172.16.255.255 is not part of our /22 — but if the company has more IP space, these are contiguous

💡 You can reproduce this exact example in our VLSM Calculator — enter 172.16.0.0/22 as the base, add the 8 networks with their host counts, and the tool will generate the same optimized plan in seconds.


VLSM Cheat Sheet

A complete reference of CIDR prefixes, subnet masks, and host counts for IPv4. Bookmark this for exam day and real-world network design.

CIDRSubnet Mask/24 equivalentBlock sizeTotal addressesUsable hosts
/32255.255.255.2551/256th110 (host route)
/31255.255.255.2541/128th222 (RFC 3021)
/30255.255.255.2521/64th442
/29255.255.255.2481/32nd886
/28255.255.255.2401/16th161614
/27255.255.255.2241/8th323230
/26255.255.255.1921/4th646462
/25255.255.255.1281/2128128126
/24255.255.255.01256256254
/23255.255.254.02512512510
/22255.255.252.041,0241,0241,022
/21255.255.248.082,0482,0482,046
/20255.255.240.0164,0964,0964,094
/19255.255.224.0328,1928,1928,190
/18255.255.192.06416,38416,38416,382
/17255.255.128.012832,76832,76832,766
/16255.255.0.025665,53665,53665,534
/15255.254.0.0512131,072131,072131,070
/14255.252.0.01,024262,144262,144262,142
/13255.248.0.02,048524,288524,288524,286
/12255.240.0.04,0961,048,5761,048,5761,048,574
/11255.224.0.08,1922,097,1522,097,1522,097,150
/10255.192.0.016,3844,194,3044,194,3044,194,302
/9255.128.0.032,7688,388,6088,388,6088,388,606
/8255.0.0.065,53616,777,21616,777,21616,777,214
/7254.0.0.0131,07233,554,43233,554,43233,554,430
/6252.0.0.0262,14467,108,86467,108,86467,108,862
/5248.0.0.0524,288134,217,728134,217,728134,217,726
/4240.0.0.01,048,576268,435,456268,435,456268,435,454
/3224.0.0.02,097,152536,870,912536,870,912536,870,910
/2192.0.0.04,194,3041,073,741,8241,073,741,8241,073,741,822
/1128.0.0.08,388,6082,147,483,6482,147,483,6482,147,483,646
/00.0.0.016,777,2164,294,967,2964,294,967,2964,294,967,294

Quick reference for common subnet sizes (CCNA essential):

  • /30 — Point-to-point links (2 usable hosts)
  • /29 — Small server cluster or management network (6 hosts)
  • /28 — Small department or IoT segment (14 hosts)
  • /27 — Medium department or guest network (30 hosts)
  • /26 — Large department (62 hosts)
  • /25 — Very large department (126 hosts)
  • /24 — Standard LAN (254 hosts — the classic)

VLSM Best Practices

1. Plan for growth, not just today

Always leave 20–30% free space in your base block. Departments grow, new VLANs appear, and mergers happen. The 152 free addresses in our earlier /24 example (59% of the block) feel like waste today but are insurance against tomorrow’s redesign.

2. Document your scheme rigorously

Use a spreadsheet, a network documentation tool, or our VLSM Calculator (which exports CSV) to record every assignment. Include network address, CIDR, mask, broadcast, purpose, location, and a contact. Without documentation, a VLSM plan becomes unmanageable within six months.

3. Use route summarization aggressively

Design your VLSM hierarchy so that subnets can be summarized at natural boundaries (/24, /16, /8). For example, if all US offices use 10.1.0.0/16 and all EU offices use 10.2.0.0/16, your core routers only need two routes, not hundreds. This principle — summarize before you advertise — is the difference between a clean network and a routing table disaster.

4. Leave gaps for expansion

When assigning subnets contiguously, consider reserving every Nth block for future use. For example, if you need 6 /28s today, allocate them inside a /26 range and leave the other /26 for growth. This way, expanding a subnet doesn’t require renumbering adjacent networks.

5. Use consistent subnet sizes for similar roles

Standardize: all WAN links get /30, all guest networks get /28, all server VLANs get /25. This makes troubleshooting easier — when you see 172.16.x.116/30, you immediately know it’s a point-to-point link. Consistency reduces human error.

6. Avoid subnet zero confusion

Modern Cisco IOS (12.0 and later) enables ip subnet-zero by default, and the CCNA exam assumes you can use subnet zero. But some legacy equipment still blocks it. Know your equipment and enable subnet zero when possible — VLSM benefits from every available block.

7. Pair VLSM with VLANs

In a switched network, each VLAN should map to exactly one VLSM subnet. This creates a clean 1:1 mapping between Layer 2 segments and Layer 3 subnets, making ACL management, QoS policy application, and troubleshooting straightforward.


Frequently Asked Questions

What is VLSM in networking?

VLSM (Variable Length Subnet Mask) is a subnetting technique that allows a network to be divided into subnets of different sizes by using different subnet mask lengths. Instead of forcing all subnets to use the same prefix length (as in FLSM), VLSM assigns each subnet the smallest mask that provides enough addresses for its hosts. This minimizes wasted IP addresses and is essential for efficient IPv4 address management in modern networks.

Why does VLSM use more bits?

VLSM doesn’t “use more bits” — it uses different numbers of bits for different subnets. In a VLSM design, some subnets may have longer prefixes (more network bits, fewer host bits) and others shorter prefixes (fewer network bits, more host bits). For example, within the same /24 block, you might have a /26 (26 network bits, 6 host bits) for a LAN and a /30 (30 network bits, 2 host bits) for a point-to-point link. The total number of bits is always 32; what changes is the split between network and host portions.

Can VLSM be used with IPv6?

IPv6 does not use the term “VLSM” because the protocol was designed with CIDR from the start. However, the same principle applies: an organization assigned a /48 can allocate /56 subnets to small branch offices, /52 to larger sites, and /64 to individual VLANs. In IPv6, the /64 boundary is mandatory for SLAAC (Stateless Address Autoconfiguration), so the “variable” part applies at the site level (prefix lengths between /48 and /64) rather than within a single subnet. The VLSM mindset — allocate only what you need, document everything, summarize where possible — is even more important in IPv6 due to the sheer address space size.

What is the difference between CIDR and VLSM?

CIDR (Classless Inter-Domain Routing) is the global routing and address allocation standard that replaced classful addressing. It defines how IP addresses are allocated by ISPs and how routes are aggregated in the Internet’s backbone. VLSM (Variable Length Subnet Mask) is the application of CIDR principles within a private network. Think of it this way:

  • CIDR is the protocol — the rules that allow variable-length prefixes.
  • VLSM is the technique — how you use those rules to subnet your assigned block.

You cannot do VLSM without CIDR, but CIDR also covers supernetting, route aggregation, and ISP-level allocation, which go beyond VLSM.

How to calculate VLSM manually?

  1. List every subnet and its required usable hosts.
  2. Add 2 to each requirement (for network and broadcast addresses).
  3. Sort subnets in descending order of need.
  4. For each subnet, find the next power of 2 ≥ the adjusted requirement. That’s your block size.
  5. Calculate the CIDR prefix: 32 - log₂(block_size).
  6. Assign ranges sequentially from your base address.
  7. Document everything in a table.

For example, needing 50 hosts → 52 adjusted → 64 block → /26. Needing 2 hosts → 4 adjusted → 4 block → /30. Then assign: 0–63 for the /26, 64–67 for the first /30, 68–71 for the next /30, etc.

⚡ Skip the manual math — use our VLSM Calculator which automates the entire process, sorts subnets automatically, and exports your plan as CSV for documentation.


Conclusion

VLSM subnetting is one of the most practical skills a network engineer can master. It’s the difference between a network that uses 30% of its IP space and one that uses 80%+. It’s the difference between a routing table with 50 entries and one with 5. It’s the difference between “we need more IPs” and “we have room to grow.”

Whether you’re studying for the CCNA, designing a campus network, or planning cloud VPCs on AWS or Azure, VLSM is the tool you’ll reach for every time. The principles are universal: allocate large blocks first, plan for growth, document everything, and summarize aggressively.

Ready to put this into practice?

  • VLSM Calculator — Enter your host requirements and get an optimized, sorted, contiguous VLSM plan in seconds. Export to CSV for documentation.
  • Subnet Calculator — For standard FLSM subnetting calculations.
  • CCNA Study Tip: Practice VLSM by hand at least 10 times with different block sizes. Then verify with our calculator. You’ll internalize the math and ace the exam questions.

Master VLSM, and you master efficient IP design.

Related articles