Published: May 26, 2026
Subnetting is the practice of dividing a larger IP network into smaller, manageable subnetworks (subnets). It improves routing efficiency, reduces broadcast domains, and helps organizations make better use of their IP address space.
Every device on a network needs a unique IP address. Without subnetting, a company with 200 devices would waste thousands of addresses in a single /16 network. Subnetting lets you carve out exactly the right-sized block for each network segment — office LAN, server farm, guest Wi-Fi, and so on.
Before 1993, IP addresses were organized into fixed classes:
This rigid system wasted enormous amounts of IP space. A company needing 300 addresses got a Class B block (65,534 addresses) — over 65,000 wasted. CIDR (Classless Inter-Domain Routing) replaced this in 1993 with variable-length subnet masks (VLSM), allowing any prefix length from /0 to /32.
/* CIDR notation examples */
192.168.1.0/24 → Netmask: 255.255.255.0 → 256 addresses (254 usable)
172.16.0.0/16 → Netmask: 255.255.0.0 → 65,536 addresses
10.0.0.0/8 → Netmask: 255.0.0.0 → 16,777,216 addresses
192.168.1.0/28 → Netmask: 255.255.255.240 → 16 addresses (14 usable)
The number after the slash is the prefix length — the number of leading 1-bits in the subnet mask. A /24 has 24 bits set to 1 (255.255.255.0), leaving 8 bits for host addresses.
A subnet mask (netmask) is a 32-bit number that separates the network portion of an IP address from the host portion. Bits set to 1 in the mask represent the network; bits set to 0 represent the host.
/* Common netmasks and their binary representation */
/8 = 255.0.0.0 = 11111111.00000000.00000000.00000000
/16 = 255.255.0.0 = 11111111.11111111.00000000.00000000
/24 = 255.255.255.0 = 11111111.11111111.11111111.00000000
/25 = 255.255.255.128 = 11111111.11111111.11111111.10000000
/26 = 255.255.255.192 = 11111111.11111111.11111111.11000000
/27 = 255.255.255.224 = 11111111.11111111.11111111.11100000
/28 = 255.255.255.240 = 11111111.11111111.11111111.11110000
/30 = 255.255.255.252 = 11111111.11111111.11111111.11111100
To find the network address, perform a bitwise AND between the IP address and the netmask. All host bits become zero, revealing which subnet the address belongs to.
Every subnet has three categories of addresses:
The formula for calculating usable hosts is: 2^(32 - prefix) - 2. The "-2" accounts for the network and broadcast addresses.
/* Calculating usable hosts for common prefix lengths */
/24: 2^(32-24) - 2 = 256 - 2 = 254 usable hosts
/25: 2^(32-25) - 2 = 128 - 2 = 126 usable hosts
/26: 2^(32-26) - 2 = 64 - 2 = 62 usable hosts
/27: 2^(32-27) - 2 = 32 - 2 = 30 usable hosts
/28: 2^(32-28) - 2 = 16 - 2 = 14 usable hosts
/30: 2^(32-30) - 2 = 4 - 2 = 2 usable hosts (point-to-point links)
You need a subnet for 200 hosts. A /24 gives 254 usable addresses — perfect.
A /30 subnet provides exactly 2 usable addresses — ideal for router-to-router links with zero waste.
Splitting 192.168.1.0/24 into four equal /26 subnets:
This is how you carve a larger block into precisely sized pieces for different departments or use cases — no wasted addresses, no crowding.
Here's a quick mental model: every bit in the host portion doubles the address count. A /24 has 8 host bits = 256 addresses. Moving to /25 adds 1 network bit (removes 1 host bit), cutting the address count in half to 128. /26 halves it again to 64, and so on.
/* Quick reference: prefix → hosts */
/24 = 254 usable (common for small offices)
/25 = 126 usable
/26 = 62 usable (small department)
/27 = 30 usable (workgroup)
/28 = 14 usable (small VLAN)
/29 = 6 usable
/30 = 2 usable (point-to-point link)
/32 = 1 address (single host / loopback)
When you're planning a network or debugging connectivity issues, manually calculating subnet boundaries can be tedious and error-prone. Use the IPv4 subnet calculator on Wang Toolbox to instantly compute network addresses, broadcast addresses, usable ranges, and host counts for any CIDR prefix. It's especially handy when working with non-standard prefix lengths like /23 or /19 where mental math gets tricky.
Whether you're configuring a home lab, setting up cloud VPCs, or studying for a networking certification, understanding CIDR subnetting is an essential skill. Start with the IPv4 subnet calculator to verify your manual calculations and build confidence — you'll be subnetting in your head before you know it.