Skip to main content

VLSM Calculator

Divide a network into variable-size subnets using VLSM. Allocate IP addresses efficiently with minimum waste — enter your host requirements and get optimal subnets.

Reference table

Subnet 4 — Required HostsAllocation EfficiencySubnets CreatedTotal Addresses Allocated
0.578.0%4116 addresses
178.4%4116 addresses
1.578.9%4116 addresses
279.3%4116 addresses
2.577.1%4120 addresses
377.5%4120 addresses
478.3%4120 addresses
579.2%4120 addresses
680.0%4120 addresses
775.8%4128 addresses
876.6%4128 addresses
977.3%4128 addresses
1078.1%4128 addresses
1279.7%4128 addresses
1572.9%4144 addresses

VLSM Tips

  • VLSM always allocates the largest subnet first, then works downward — this minimizes fragmentation.
  • Each subnet loses 2 addresses (network + broadcast) — plan for this overhead.
  • Add 10–20% to your host count for future growth before entering requirements.
  • VLSM is more efficient than fixed subnetting: a /24 split with VLSM can save 30–50% of wasted IPs.

What Is VLSM?

Variable Length Subnet Masking (VLSM) is a subnetting technique that allows network administrators to use different subnet mask sizes within the same address space. Unlike fixed-length subnetting where every subnet must be the same size, VLSM lets you create subnets tailored to the exact number of hosts each segment needs. For example, a department with 200 workstations gets a /24 subnet (254 hosts), while a point-to-point router link gets a /30 (2 hosts). This dramatically reduces IP address waste compared to giving both segments the same /24. VLSM became possible with the adoption of CIDR (Classless Inter-Domain Routing) and requires routing protocols that carry subnet mask information, such as OSPF, EIGRP, IS-IS, or BGP.

How VLSM Allocation Works

The VLSM algorithm follows a simple principle: sort all subnet requirements from largest to smallest, then allocate each one using the smallest subnet mask that fits. Start with the largest requirement — find the minimum CIDR prefix that provides enough hosts (usable = 2^host_bits − 2). Allocate that block starting from the next available address in the major network. Then move to the next largest requirement and repeat. This largest-first approach ensures optimal alignment and prevents fragmentation. For example, starting with 192.168.1.0/24 (254 usable), if you need 100, 50, and 10 hosts: the first gets /25 (126 usable), the second gets /26 (62 usable), and the third gets /28 (14 usable), using 128 + 64 + 16 = 208 of 256 addresses with 48 remaining for future growth.

VLSM Planning Guidelines

  • Always sort subnets by size (largest first) before allocating — this prevents address space fragmentation.
  • Each subnet must align to its block size: a /26 (64 addresses) must start at a multiple of 64.
  • The minimum practical subnet is /30 (2 usable hosts) for router links; /28 (14 hosts) for device networks.
  • Add 20% growth margin: if you need 100 hosts, plan for 120 — this still fits in a /25 (126 usable).
  • Fixed subnetting a /24 into equal /26 blocks gives 4 × 62 = 248 hosts. VLSM can fit the same needs in fewer addresses.
  • Document your VLSM plan carefully — variable-size subnets are harder to troubleshoot than fixed ones.

VLSM vs Fixed Subnetting Comparison

  • Fixed /26 for 200 + 50 + 10: needs 4 subnets = 256 IPs, wastes 196 (23% efficiency).
  • VLSM for 200 + 50 + 10: /24 + /26 + /28 = 336 IPs needed, but only 256 + 64 + 16 = 336 (77% efficiency).
  • ISP allocation: VLSM lets ISPs give /28 to small clients, /24 to medium, /22 to large — from one /16 block.
  • Campus network: admin (200 PCs) gets /24, lab (30 PCs) gets /27, security cams (8) get /28.
  • Data center: production VLAN /23 (510 hosts), management /27 (30), out-of-band /29 (6).
  • Home lab: main LAN /25 (126), IoT /28 (14), guest Wi-Fi /28 (14) — all from one /24.

VLSM Allocation Examples

Step-by-step subnet division

Office: 192.168.1.0/24 → 4 Subnets

  1. Requirements: Engineering (100), Sales (50), HR (20), Router links (2)
  2. Sort largest first: 100, 50, 20, 2
  3. Subnet 1: 100 hosts → need /25 (126 usable). Network: 192.168.1.0/25, range .1–.126
  4. Subnet 2: 50 hosts → need /26 (62 usable). Network: 192.168.1.128/26, range .129–.190
  5. Subnet 3: 20 hosts → need /27 (30 usable). Network: 192.168.1.192/27, range .193–.222
  6. Subnet 4: 2 hosts → need /30 (2 usable). Network: 192.168.1.224/30, range .225–.226

Used 200 of 256 addresses (78% efficiency). 56 addresses remain for growth.

Campus: 10.10.0.0/22 → 3 Buildings

  1. Total available: /22 = 1,022 usable addresses
  2. Requirements: Main building (500), Annex (200), Lab (50)
  3. Subnet 1: 500 → need /23 (510 usable). Network: 10.10.0.0/23, range .0.1–.1.254
  4. Subnet 2: 200 → need /24 (254 usable). Network: 10.10.2.0/24, range .2.1–.2.254
  5. Subnet 3: 50 → need /26 (62 usable). Network: 10.10.3.0/26, range .3.1–.3.62
  6. Remaining: 10.10.3.64/26 through 10.10.3.255 (192 addresses for future use)

Used 832 of 1,024 addresses. 192 remain — enough for two more /26 subnets.

Frequently Asked Questions

What is the difference between VLSM and CIDR?

CIDR (Classless Inter-Domain Routing) is the notation system that allows variable-length prefixes (e.g. /22, /27). VLSM (Variable Length Subnet Masking) is the technique of applying different CIDR prefix lengths to different subnets within the same address block. Think of CIDR as the language and VLSM as the design practice that uses it. VLSM requires CIDR-aware routing protocols like OSPF or EIGRP.

Which routing protocols support VLSM?

Modern protocols that carry subnet mask information support VLSM: OSPF (Open Shortest Path First), EIGRP (Enhanced Interior Gateway Routing Protocol), IS-IS, BGP, and RIPv2. The older RIPv1 does NOT support VLSM because it assumes classful boundaries and doesn't include the mask in routing updates. Static routes also support VLSM since the mask is manually specified.

Why must I sort subnets from largest to smallest?

Subnets must align to their block size — a /26 (64 addresses) must start at a multiple of 64. If you allocate a small subnet first, you may create a gap that wastes addresses because the next larger subnet can't fit there. Sorting largest-first ensures each block starts at a naturally aligned boundary, maximizing usable space and preventing fragmentation.

How do I know what subnet size I need for N hosts?

Find the smallest power of 2 that is greater than N + 2 (the +2 accounts for network and broadcast addresses). For 100 hosts: 100 + 2 = 102, next power of 2 is 128 = 2⁷, so host bits = 7, prefix = 32 − 7 = /25 (126 usable). For 50 hosts: 52 → 64 = 2⁶ → /26 (62 usable). For 10 hosts: 12 → 16 = 2⁴ → /28 (14 usable).

Can I use VLSM with IPv6?

IPv6 uses a fixed /64 prefix for all host subnets as recommended by RFC 4291, giving each subnet 2⁶⁴ addresses — more than enough for any LAN. VLSM-style variable prefixes are used at higher levels (between /48 and /64) for allocating subnets to departments, but within each subnet the size is always /64. The massive address space of IPv6 eliminates the need for VLSM at the host level.

What happens if my hosts don't fit in the network block?

If the total required addresses exceed the available space in your major network, the VLSM calculation fails. For example, trying to fit 200 + 100 + 50 hosts into a /24 (254 total addresses) won't work because you need /24 (256) + /25 (128) + /26 (64) = 448 addresses. Solution: use a larger network block (like /23 or /22) or reduce your host requirements.

Sources