VLSM Calculator

Calculate optimal Variable Length Subnet Mask (VLSM) allocations for any parent network. Enter your base network in CIDR notation and the number of hosts required for each subnet — the calculator assigns the smallest possible subnet to each requirement, sorted largest-first to minimize wasted address space.

VLSM Calculator
Figure 1 — VLSM Calculator

What Is VLSM?

Variable Length Subnet Mask (VLSM) is a subnetting technique that allows you to use different subnet mask lengths within the same address space. Unlike fixed-length subnetting (FLSM), where every subnet gets the same size, VLSM assigns the smallest possible subnet to each requirement — dramatically reducing wasted addresses. This is the standard approach used in modern IP networking.

For example, if you have a /24 network (256 addresses) and need subnets for 50 hosts, 20 hosts, 10 hosts, and a point-to-point link (2 hosts), FLSM would force you to use four /26 subnets (64 addresses each), wasting space on the smaller requirements. VLSM lets you use /26, /27, /28, and /30 respectively, fitting everything more efficiently. Check exact subnet boundaries for each prefix length.

VLSM vs Fixed-Length Subnetting

Understanding the difference between VLSM and FLSM is fundamental to efficient subnet mask allocation. Here is a direct comparison:

AspectFixed-Length (FLSM)Variable-Length (VLSM)
Mask ConsistencySame mask for all subnetsDifferent mask per subnet
Address EfficiencyLow — smallest need dictates all sizesHigh — each subnet sized to requirement
ComplexitySimple to plan and calculateRequires sorting and sequential allocation
Routing Protocol SupportAll protocols (RIPv1, etc.)Classless only (RIPv2, OSPF, EIGRP, BGP)
Waste Example (50+20+10+2 hosts)4× /26 = 256 used, 164 wasted/26+/27+/28+/30 = 160 used, 68 wasted
Real-World UsageLegacy networks onlyStandard practice everywhere

Pro Tip: Always sort your subnet requirements from largest to smallest before allocating. VLSM allocates sequentially, and placing the largest subnets first ensures proper alignment on power-of-two boundaries. The calculator above handles this automatically, but it's critical to understand when planning manually. Verify your results with the CIDR Converter.

How the VLSM Algorithm Works

The VLSM allocation process follows a systematic approach. Here is how this calculator (and how you should manually) determine subnet assignments:

  1. List all subnet requirements — Name each subnet and specify the number of usable hosts needed.
  2. Sort from largest to smallest — This ensures proper alignment and minimizes gaps.
  3. For each requirement, calculate the minimum subnet size:
    • Add 2 to the host count (for network and broadcast addresses).
    • Round up to the nearest power of 2.
    • Determine the CIDR prefix: /prefix = 32 - log2(block size).
  4. Assign addresses sequentially — Start from the base network address and allocate each subnet contiguously.
  5. Verify remaining space — Ensure the parent network has enough addresses for all subnets.
Parent Network: 192.168.1.0/24 (256 addresses)

Requirement         Hosts  + 2  Rounded  Prefix  Network          Range
Sales (50 hosts)     50     52    64      /26     192.168.1.0/26   .1 – .62
Engineering (30)     30     32    32      /27     192.168.1.64/27  .65 – .94
Management (10)      10     12    16      /28     192.168.1.96/28  .97 – .110
Server Room (5)       5      7     8      /29     192.168.1.112/29 .113 – .118
P2P Link (2)          2      4     4      /30     192.168.1.120/30 .121 – .122

Total used: 124 of 256 addresses (48%)
Remaining: 132 addresses for future growth

You can verify each subnet's boundaries using the IP Range Calculator or check binary representations with the IP to Binary Converter.

Note: VLSM requires a routing protocol that supports classless addressing — OSPF, EIGRP, RIPv2, IS-IS, or BGP. The older RIPv1 protocol only supports fixed-length subnetting because it does not include subnet mask information in its routing updates. If you're running OSPF, you'll need wildcard masks for network statements — use our Wildcard Mask Calculator for the conversion.

VLSM Subnet Size Reference

This table shows the relationship between host requirements and the minimum subnet size needed. Reference this when planning DHCP scopes or static IP allocations:

Hosts NeededAdd 2 (Net+BC)Block SizeCIDR PrefixSubnet MaskUsable Hosts
134/30255.255.255.2522
244/30255.255.255.2522
5-67-88/29255.255.255.2486
7-149-1616/28255.255.255.24014
15-3017-3232/27255.255.255.22430
31-6233-6464/26255.255.255.19262
63-12665-128128/25255.255.255.128126
127-254129-256256/24255.255.255.0254

VLSM Design Best Practices

Proper VLSM design goes beyond just fitting subnets into an address block. Follow these best practices when planning your network at 192.168.1.1 or any enterprise deployment:

  • Plan for growth — Allocate subnets at 50-60% capacity to leave room for expansion. A department needing 20 hosts today should get a /27 (30 usable), not a tight /27 with exactly 20 used.
  • Use consistent naming — Label each subnet with its purpose (Sales, Engineering, DMZ, P2P-WAN-Link) for clear documentation.
  • Reserve space for infrastructure — Point-to-point WAN links need /30 or /31 subnets. Loopback interfaces need /32s. Don't forget these when planning.
  • Document everything — Record each allocation in an IP address management (IPAM) spreadsheet or tool. Our calculator provides the output in a table format you can copy directly.
  • Leave contiguous free space — Don't scatter small allocations throughout your range. Keep unallocated space at the end for future use.

For networks using NAT, VLSM design applies to your internal address space. Your public-facing side typically uses a single IP or a small block from your ISP. Check your public address with What Is My IP.

Configuring VLSM Subnets on a Router

After calculating your VLSM allocations, here is how to configure them on a Cisco router with OSPF:

! Configure interfaces with VLSM subnets
interface GigabitEthernet0/0
 description Sales LAN
 ip address 192.168.1.1 255.255.255.192
!
interface GigabitEthernet0/1
 description Engineering LAN
 ip address 192.168.1.65 255.255.255.224
!
interface GigabitEthernet0/2
 description Management LAN
 ip address 192.168.1.97 255.255.255.240
!
interface Serial0/0/0
 description WAN Point-to-Point
 ip address 192.168.1.121 255.255.255.252
!
! OSPF with wildcard masks for each VLSM subnet
router ospf 1
 network 192.168.1.0 0.0.0.63 area 0
 network 192.168.1.64 0.0.0.31 area 0
 network 192.168.1.96 0.0.0.15 area 0
 network 192.168.1.120 0.0.0.3 area 0

Notice that each OSPF network statement uses a different wildcard mask matching the VLSM allocation. Convert subnet masks to wildcards with our Wildcard Mask Calculator, or check the full hex representation for ACL debugging. For help accessing your router's admin panel, see our Find Router IP Address guide.

Common VLSM Mistakes

These are the most frequent errors network engineers encounter when implementing VLSM. Avoid them by using this calculator to verify your math:

MistakeConsequencePrevention
Not sorting largest-firstAlignment gaps waste addressesAlways sort descending by host count
Forgetting network + broadcastSubnet too small for hostsAlways add 2 to the host requirement
Overlapping subnetsRouting ambiguity, packet lossAllocate sequentially, verify with Same Subnet Checker
Using classful routing protocolSubnets ignored at different mask lengthsUse OSPF, EIGRP, or RIPv2 only
No growth marginPainful re-addressing laterSize subnets at 50-60% initial utilization
Key Takeaways
  • VLSM assigns different-sized subnets within the same address space, minimizing waste.
  • Always sort requirements largest-to-smallest and add 2 (network + broadcast) to each host count.
  • VLSM requires classless routing protocols: OSPF, EIGRP, RIPv2, IS-IS, or BGP.
  • Plan for 50-60% initial utilization to allow growth without re-addressing.
  • Point-to-point links need /30 (2 usable) or /31 (2 usable, RFC 3021).
  • Use the Subnet Calculator to verify individual subnet boundaries after allocation.

Video: VLSM Subnetting Tutorial

Related Tools and Guides

Frequently Asked Questions

What does VLSM stand for?

VLSM stands for Variable Length Subnet Mask. It is a subnetting method that allows different subnets within the same major network to use different subnet mask lengths, enabling more efficient use of IP address space compared to fixed-length subnetting.

Why must subnets be sorted largest-first in VLSM?

Larger subnets require alignment on larger power-of-two boundaries. If you allocate a small subnet first, the next large subnet may not align properly, creating gaps that waste addresses. Sorting largest-first guarantees optimal alignment and minimal waste.

Can I use VLSM with RIPv1?

No. RIPv1 is a classful routing protocol that does not include subnet mask information in its routing updates. VLSM requires classless protocols like OSPF, EIGRP, RIPv2, or BGP that carry the mask with each route advertisement.

How many addresses do I lose to network and broadcast?

Every subnet loses exactly 2 addresses — the network address (all host bits = 0) and the broadcast address (all host bits = 1). A /28 has 16 total addresses but only 14 usable hosts. The exception is /31 (RFC 3021), which allows 2 usable hosts on point-to-point links with no broadcast. Use our Subnet Calculator to see exact counts.

What is the smallest usable VLSM subnet?

A /30 subnet provides 2 usable host addresses, which is the minimum for a standard subnet with network and broadcast. A /31 subnet (RFC 3021) also provides 2 usable addresses on point-to-point links by eliminating the broadcast. A /32 is a host route used for loopback interfaces.

How do I know if my network supports VLSM?

If your routing protocol is OSPF, EIGRP, RIPv2, IS-IS, or BGP, you support VLSM. Check your router configuration by logging into the admin panel at 192.168.1.1 or 10.0.0.1. Enterprise routers running any modern IOS version support all classless protocols.

Can VLSM be used with IPv6?

IPv6 uses prefix-length notation similar to CIDR, but the concept of VLSM is less critical because the address space is so large (128 bits). Most IPv6 deployments use a uniform /64 prefix for all subnets. However, the same variable-prefix principle can technically be applied. For IPv6 tools, try our IPv6 Converter.

About Tommy N.

Tommy is the founder of RouterHax and a network engineer with 10+ years of experience in home and enterprise networking. He specializes in router configuration, WiFi optimization, and network security. When not writing guides, he's testing the latest mesh WiFi systems and helping readers troubleshoot their home networks.

Promotion for FREE Gifts. Moreover, Free Items here. Disable Ad Blocker to get them all.

Once done, hit any button as below