Subnet Generator

Generate subnet ranges

Understanding Subnetting and VLSM
TL;DR

Subnetting divides a large network into smaller logical segments. VLSM allows subnets of different sizes within the same network, optimizing IP address usage.

What is Subnetting?

Subnetting is the practice of dividing a single IP network into two or more smaller, logical sub-networks (subnets). Each subnet functions as an independent network segment with its own network address, broadcast address, and range of usable host addresses.

Subnetting serves three primary goals:

  1. Efficient address utilization: Instead of allocating one large block and wasting most of it, you carve out right-sized blocks that match the actual number of hosts in each segment.
  2. Network segmentation: Subnets create broadcast domains. Devices in one subnet do not receive broadcast traffic from another, reducing congestion and improving performance.
  3. Security boundaries: Firewalls and access control lists can enforce policies between subnets, isolating sensitive systems (databases, management interfaces) from general-purpose networks.

In practical terms, subnetting means borrowing bits from the host portion of an IP address and reassigning them to the network portion. Each borrowed bit doubles the number of possible subnets while halving the number of hosts per subnet.

Fixed-Length vs VLSM

Fixed-Length Subnet Masking (FLSM)

In fixed-length subnetting, every subnet in the network uses the same prefix length. If you divide a /24 into four subnets, each one is a /26 with exactly 62 usable hosts.

This approach is simple and predictable, but it wastes addresses when subnets have very different sizes. A point-to-point link between two routers only needs 2 addresses, but under FLSM it would receive the same 62-address block as a busy office floor.

Variable-Length Subnet Masking (VLSM)

VLSM allows you to assign different prefix lengths to different subnets within the same network. This means you can carve out a /26 for a large department, a /28 for a small team, and a /30 for a router link — all from the same parent block.

VLSM is the standard approach in modern network design because it dramatically reduces waste. The trade-off is increased planning complexity: you must carefully track which address ranges have been allocated to avoid overlaps.

VLSM Subnet Tree — /24 Split A hierarchical tree diagram showing a /24 network split into two /25 subnets. The left /25 is further divided into two /26 subnets, and the left /26 is further divided into two /27 subnets, demonstrating variable-length subnet masking. VLSM Subnet Tree 10.0.0.0/24 254 hosts 10.0.0.0/25 126 hosts 10.0.0.128/25 126 hosts (servers) 10.0.0.0/26 62 hosts 10.0.0.64/26 62 hosts (Wi-Fi) 10.0.0.0/27 30 hosts (Eng) 10.0.0.32/27 30 hosts (Sales) Allocation Summary: Engineering: 10.0.0.0/27 (30 hosts) Sales: 10.0.0.32/27 (30 hosts) Wi-Fi: 10.0.0.64/26 (62 hosts) Servers: 10.0.0.128/25 (126 hosts) Total used: 248 of 254 Each level borrows 1 more bit from the host portion, halving the subnet size. VLSM lets you stop splitting at any level, matching subnet size to actual need.

Subnetting Math

The core arithmetic behind subnetting follows a consistent pattern. When you increase the prefix length by 1 (e.g., from /24 to /25), you divide the block in half. Increase by 2 (e.g., /24 to /26) and you get four subnets, and so on.

Subnetting Cheat Sheet

ParentSubnet PrefixNumber of SubnetsUsable Hosts per SubnetSubnet Mask
/24/241254255.255.255.0
/24/252126255.255.255.128
/24/26462255.255.255.192
/24/27830255.255.255.224
/24/281614255.255.255.240
/24/29326255.255.255.248
/24/30642255.255.255.252

The formula is straightforward:

  • Number of subnets = 2^(new_prefix - original_prefix)
  • Hosts per subnet = 2^(32 - new_prefix) - 2

The “minus 2” accounts for the network address (all host bits = 0) and the broadcast address (all host bits = 1), which cannot be assigned to devices.

Step-by-Step Example

Divide 10.0.0.0/24 into 4 equal subnets:

  1. Determine the new prefix: 4 subnets = 2^2, so borrow 2 bits from the host portion. New prefix = 24 + 2 = /26.
  2. Calculate hosts per subnet: 2^(32-26) - 2 = 64 - 2 = 62 usable hosts.
  3. List the subnets:
    • 10.0.0.0/26 (range: 10.0.0.1 - 10.0.0.62)
    • 10.0.0.64/26 (range: 10.0.0.65 - 10.0.0.126)
    • 10.0.0.128/26 (range: 10.0.0.129 - 10.0.0.190)
    • 10.0.0.192/26 (range: 10.0.0.193 - 10.0.0.254)

Each subnet’s starting address is the previous subnet’s starting address plus the block size (64 in this case, since 2^(32-26) = 64).

Common Use Cases

  • Enterprise network design: Segmenting a corporate network into subnets for departments (engineering, HR, finance), infrastructure (servers, printers), and guest access
  • Cloud VPC design: AWS, Azure, and GCP all require subnet planning within a VPC, typically using VLSM to allocate different-sized subnets for public, private, and database tiers
  • Data center fabric: Leaf-spine architectures use /31 or /30 subnets for point-to-point links between switches and larger subnets for server-facing networks
  • IP address management (IPAM): Tools like NetBox, Infoblox, and phpIPAM use subnet hierarchies to track allocations and prevent overlapping assignments
  • Network migration: When consolidating offices or migrating to a new address scheme, subnetting ensures the new design accommodates all segments without overlap
  • Exam preparation: Subnetting is a core topic in networking certifications (CCNA, CompTIA Network+, JNCIA) and a frequent interview question for network engineering roles

Try These Examples

Split /24 into 4 Equal Subnets Valid

Dividing a /24 (256 addresses) into 4 equal subnets produces four /26 blocks, each with 62 usable hosts: 10.0.0.0/26, 10.0.0.64/26, 10.0.0.128/26, and 10.0.0.192/26.

10.0.0.0/24
Invalid Split — Not Enough Space Invalid

A /30 only contains 4 addresses (2 usable). Splitting it into 4 subnets would require /32 blocks with zero usable host addresses, making this impractical for host assignment.

10.0.0.0/30