VLSM Explained with Examples

Go from theory to practice with Variable Length Subnet Masking.

Variable Length Subnet Masking (VLSM) is a more efficient way to subnet a network. Unlike traditional (or fixed-length) subnetting, where all subnets must be the same size, VLSM allows you to create subnets of different sizes from the same parent network. This flexibility is key to minimizing wasted IP addresses.

The core idea is simple: use a long mask (fewer host bits) for small networks and a short mask (more host bits) for large networks.

To see this in action, try our powerful VLSM Calculator.

The Golden Rule of VLSM

Always satisfy the largest host requirement first!

You must sort your subnet requirements from largest to smallest before you begin allocating IP space. Failure to do so will result in "fragmenting" your address space, making it impossible to allocate a large, contiguous block for your biggest network requirement.

Practical Example

Let's take the network block 10.10.0.0/16 and subnet it for the following needs:

  • Subnet A: 1000 hosts
  • Subnet B: 400 hosts
  • Subnet C: 100 hosts
  • Subnet D: 50 hosts

1. Subnet A (1000 hosts):

  • We need 1000 + 2 (network/broadcast) = 1002 addresses.
  • The closest power of 2 is 1024 (210). So, we need 10 host bits.
  • New prefix: 32 - 10 = /22.
  • Allocation: Network 10.10.0.0/22 (Range: 10.10.0.0 - 10.10.3.255)

2. Subnet B (400 hosts):

  • We need 400 + 2 = 402 addresses.
  • The closest power of 2 is 512 (29). So, we need 9 host bits.
  • New prefix: 32 - 9 = /23.
  • Allocation: Starts after Subnet A. Network 10.10.4.0/23 (Range: 10.10.4.0 - 10.10.5.255)

3. Subnet C (100 hosts):

  • We need 100 + 2 = 102 addresses.
  • The closest power of 2 is 128 (27). So, we need 7 host bits.
  • New prefix: 32 - 7 = /25.
  • Allocation: Starts after Subnet B. Network 10.10.6.0/25 (Range: 10.10.6.0 - 10.10.6.127)

4. Subnet D (50 hosts):

  • We need 50 + 2 = 52 addresses.
  • The closest power of 2 is 64 (26). So, we need 6 host bits.
  • New prefix: 32 - 6 = /26.
  • Allocation: Starts after Subnet C. Network 10.10.6.128/26 (Range: 10.10.6.128 - 10.10.6.191)

By following this method, we have successfully created four differently sized subnets from a single block, wasting far fewer addresses than with a fixed-length approach. To see how many IPs you save, you can use our Wasted IPs Calculator.