Quick VLSM Calculator Online - IPv4 Subnetting Tool

VLSM Subnet Calculator

Variable Length Subnet Mask — Cisco-accurate cascading allocation

Base Network
Enter the base network address (e.g., 192.168.1.0) — you may also paste with CIDR, e.g. 172.35.0.0/16
Select prefix length /8–/30
Subnet Requirements
#Subnet Name / LabelHosts Required

The Complete VLSM Guide: Bit-Borrowing, Subnet Listing, and Cisco-Accurate Cascading Allocation

Variable Length Subnet Masking (VLSM) is one of the most powerful and practical tools in a network engineer's toolkit. Unlike its predecessor Fixed Length Subnet Masking (FLSM), which forces every subnet to be exactly the same size regardless of actual need, VLSM allows you to carve an address block into subnets of different sizes — each tailored precisely to the number of hosts it must serve. The result is dramatically more efficient IP address utilization, which is critical in both enterprise networks and CCNA/CCNP examinations.

This guide walks you through the complete academic methodology that powers the VLSM Subnet Calculator above, covering the three golden rules, the bit-borrowing formula, and a detailed step-by-step walkthrough of the default example.

Why VLSM Beats FLSM

Imagine you are assigned the block 172.35.0.0/16 and you need to support seven departments with wildly different sizes — one with 320 hosts and several point-to-point links needing only 2 hosts each. With FLSM you would be forced to size every subnet for the largest requirement (320 hosts), which means each subnet consumes a /23 block of 512 addresses. Your tiny 2-host links would each waste 510 addresses. VLSM solves this by letting you allocate a /23 only where you need 320 hosts, a /25 where you need 115 hosts, and a /30 (only 4 addresses) where you need just 2 hosts.

The address space is used surgically, with almost nothing wasted.

The Three Golden Rules of VLSM

Rule 1 — Sort Subnets from Largest to Smallest

Before allocating a single address, sort your list of subnet requirements in descending order by host count. This is the single most important rule of VLSM. If you allocate a small subnet first, you may inadvertently misalign the address pointer, forcing later large subnets to skip huge gaps of address space just to satisfy alignment constraints. By always placing the largest requirement at the top, you guarantee that each allocation sits on a naturally aligned boundary with zero waste between consecutive blocks.

The calculator enforces this automatically, but understanding why this order matters will save you in any exam or real-world design scenario.

Rule 2 — The Host Bits Formula: 2n − 2 ≥ Required Hosts

Once sorted, you must determine how many host bits (n) each subnet requires. The formula is 2n − 2 ≥ required hosts. The subtraction of 2 accounts for the two reserved addresses in every subnet: the Network Address (all host bits = 0) and the Broadcast Address (all host bits = 1), neither of which can be assigned to a device. You find the smallest integer n that satisfies the inequality. For example, if you need 320 hosts: 28 − 2 = 254 (not enough), so try 29 − 2 = 510 ≥ 320 — therefore n = 9. The new prefix length is simply 32 − n, and the block size (total addresses in the subnet) is 2n.

Rule 3 — The Borrowed Bits Formula: m = 32 − current_block_prefix − n

This is the academic core of the bit-borrowing methodology. When you allocate a subnet, you are not pulling it from thin air — you are subdividing the current available address pool, which itself has a specific prefix length. The variable m represents the number of bits you must borrow from that pool's host portion in order to create subnets of the required size. The formula is: m = 32 − current_block_prefix − n. Borrowing m bits creates exactly 2m new subnets of the new prefix length. You always pick the first available subnet from this generated list and assign it to the current requirement.

The remaining subnets in the list become the new available pool for future allocations. When m = 0, no subdivision is needed — the block is consumed directly as-is. Understanding this formula transforms VLSM from a mechanical exercise into a deeply logical and predictable process.

Step-by-Step Walkthrough: 172.35.0.0/16

The following walkthrough uses the exact default example loaded in the calculator: base network 172.35.0.0/16 with seven subnet requirements — A: 320 hosts, B: 115 hosts, C: 80 hosts, D: 30 hosts, E: 2 hosts, F: 2 hosts, G: 2 hosts. Every step mirrors the output of the Step-by-Step Solution panel in the tool above.

Pre-Step — The Base Network in Binary

Before any calculation, anchor yourself to the base block. The network 172.35.0.0/16 has a subnet mask of 255.255.0.0. In binary, the address is 10101100.00100011.00000000.00000000. The first 16 bits (10101100.00100011) are the fixed Network ID (NetID) bits — they never change across any subnet in this space. The remaining 16 bits are the Host ID portion, which is the raw material we will be subdividing. The total address space is 216 = 65,536 addresses, spanning from 172.35.0.0 to 172.35.255.255.

Step 1 — Sort Subnets (Largest First)

Applying Rule 1, we reorder the seven requirements in descending order by host count. The sorted allocation queue becomes: A (320) → B (115) → C (80) → D (30) → E (2) → F (2) → G (2). The address pointer starts at the very beginning of the base network: 172.35.0.0.

Step 2 — Allocate Subnet A (320 Hosts)

We apply the host bits formula: 28 − 2 = 254 < 320, so try n = 9: 29 − 2 = 510 ≥ 320. Therefore n = 9, giving a block size of 29 = 512 addresses and a new prefix of 32 − 9 = /23. Now apply the borrowed bits formula. The current pool is the base network /16, so current_block_prefix = 16: m = 32 − 16 − 9 = 7. Borrowing 7 bits from the /16 pool creates 27 = 128 subnets of /23. We assign the very first one: 172.35.0.0/23 (subnet mask 255.255.254.0), with an assignable range of 172.35.0.1 – 172.35.1.254 and broadcast address 172.35.1.255.

The address pointer advances to 172.35.2.0, which now represents the start of the next available /23 block from the 128-subnet list.

Step 3 — Allocate Subnet B (115 Hosts)

Applying the host bits formula: 26 − 2 = 62 < 115, so try n = 7: 27 − 2 = 126 ≥ 115. Therefore n = 7, block size = 128, new prefix = /25. The current pool starts at 172.35.2.0 and belongs to the leftover /23 block, so current_block_prefix = 23: m = 32 − 23 − 7 = 2. Borrowing 2 bits from the /23 pool creates 22 = 4 subnets of /25. We assign the first one: 172.35.2.0/25 (subnet mask 255.255.255.128), with an assignable range of 172.35.2.1 – 172.35.2.126 and broadcast address 172.35.2.127. The address pointer advances to 172.35.2.128.

Step 4 — Allocate Subnet C (80 Hosts)

Applying the host bits formula: 27 − 2 = 126 ≥ 80, so n = 7, block size = 128, new prefix = /25. The current pool starts at 172.35.2.128 within the existing /25 block, so current_block_prefix = 25: m = 32 − 25 − 7 = 0. Since m = 0, no further borrowing is needed — the block is consumed directly. We assign: 172.35.2.128/25 (subnet mask 255.255.255.128), assignable range 172.35.2.129 – 172.35.2.254, broadcast 172.35.2.255. The pointer advances to 172.35.3.0.

Step 5 — Allocate Subnet D (30 Hosts)

Applying the host bits formula: 25 − 2 = 30 ≥ 30, so n = 5, block size = 32, new prefix = /27. The pool starts at 172.35.3.0 from the prior /25 block, so current_block_prefix = 25: m = 32 − 25 − 5 = 2. Borrowing 2 bits creates 22 = 4 subnets of /27. We assign the first: 172.35.3.0/27 (subnet mask 255.255.255.224), assignable range 172.35.3.1 – 172.35.3.30, broadcast 172.35.3.31. The pointer advances to 172.35.3.32.

Steps 6–8 — Allocate Subnets E, F, and G (2 Hosts Each)

For each of the three 2-host subnets, the formula yields: 22 − 2 = 2 ≥ 2, so n = 2, block size = 4, new prefix = /30. Subnet E is drawn from the leftover /27 block at 172.35.3.32 (current_block_prefix = 27): m = 32 − 27 − 2 = 3, creating 23 = 8 subnets of /30. The first is assigned: 172.35.3.32/30, range 172.35.3.33 – 172.35.3.34, broadcast 172.35.3.35. Subnet F continues from 172.35.3.36 (current_block_prefix = 30): m = 32 − 30 − 2 = 0 — no borrowing needed, assigned directly as 172.35.3.36/30, range 172.35.3.37 – 172.35.3.38, broadcast 172.35.3.39.

Subnet G likewise has m = 0, assigned as 172.35.3.40/30, range 172.35.3.41 – 172.35.3.42, broadcast 172.35.3.43.

Final Allocation Table

The table below summarizes the complete VLSM allocation for the 172.35.0.0/16 base network. After all seven subnets are assigned, the remaining unused address space spans from 172.35.3.44 to 172.35.255.255 — a testament to how precisely VLSM conserves addresses compared to FLSM.

# Subnet Name Needed Hosts Allocated Size Network Address Subnet Mask CIDR Assignable Range Broadcast Address
1 A 320 510 172.35.0.0 255.255.254.0 /23 172.35.0.1 – 172.35.1.254 172.35.1.255
2 B 115 126 172.35.2.0 255.255.255.128 /25 172.35.2.1 – 172.35.2.126 172.35.2.127
3 C 80 126 172.35.2.128 255.255.255.128 /25 172.35.2.129 – 172.35.2.254 172.35.2.255
4 D 30 30 172.35.3.0 255.255.255.224 /27 172.35.3.1 – 172.35.3.30 172.35.3.31
5 E 2 2 172.35.3.32 255.255.255.252 /30 172.35.3.33 – 172.35.3.34 172.35.3.35
6 F 2 2 172.35.3.36 255.255.255.252 /30 172.35.3.37 – 172.35.3.38 172.35.3.39
7 G 2 2 172.35.3.40 255.255.255.252 /30 172.35.3.41 – 172.35.3.42 172.35.3.43

How the Calculator Automates This Process

Every calculation shown in this guide — the sorting, the host bits formula, the borrowed bits formula, the cascading pointer arithmetic, and the binary subnet listing — is executed automatically by the VLSM Subnet Calculator above the moment you click Calculate VLSM. The Step-by-Step Solution panel renders each step with full binary representations: network bits are highlighted in blue, borrowed bits in orange, and remaining host bits in gray, so you can visually trace every bit-borrowing decision.

The subnet listing table inside each step shows all 2m generated subnets (or a truncated view with an ellipsis if 2m exceeds five), clearly marking the first subnet as the assigned one. Whether you are a CCNA student building your intuition or a seasoned network engineer validating a design, the goal is always the same: make every address count, waste nothing, and document every decision with mathematical precision. VLSM is not just a technique — it is a discipline.

Subscribe
Notify of
guest

9 Corrections & Clarifications