HomeGuidesThe Complete Guide to IPv4 Subnetting & CIDR Calculation (For Sysadmins & CCNA)
DevOps & System7 min readUpdated 2026-11-04

The Complete Guide to IPv4 Subnetting & CIDR Calculation (For Sysadmins & CCNA)

Demystify network IDs, broadcast addresses, slash notation (/24, /16, /8), and usable host ranges with clear mathematical examples.

Need to do this immediately?

Use our free, private client-side browser tool with zero installation.

Launch Visual CIDR Subnet Calculator
Subnetting is the foundational pillar of modern computer networking, cloud VPC architecture (AWS, Azure, GCP), and container orchestration with Docker and Kubernetes. Understanding how bitwise masks partition networks prevents IP exhaustion and misconfiguration.

How IPv4 Addresses and Netmasks Function

An IPv4 address consists of 32 binary bits divided into four 8-bit octets separated by dots (e.g., 192.168.1.1). The subnet mask determines which portion of those 32 bits designates the Network ID (routing prefix) and which portion represents assignable Host devices.

In CIDR (Classless Inter-Domain Routing) notation, a slash followed by a number indicates how many leading bits are frozen for the network. For example, /24 means the first 24 bits are 1s (255.255.255.0), leaving 8 bits for host addresses.

The Formula for Usable Host Calculations

The total number of IP addresses in any subnet is 2^(32 - CIDR). However, in standard IPv4 routing, two addresses are reserved: the first address (all host bits 0) is the Network ID, and the last address (all host bits 1) is the Broadcast Address.

Therefore, Usable Hosts = 2^(32 - CIDR) - 2. For a /24 network, 2^8 - 2 = 254 usable host addresses.

Pro Tip:Cloud providers like AWS reserve 5 IP addresses per subnet (Network, Router, DNS, Future Use, and Broadcast). A /28 subnet provides 11 usable instances on AWS rather than 14.

Step-by-Step Tutorial

1

Identify IP & Prefix

Determine the host IP and required network capacity (e.g., 10.0.0.0 with /20 prefix).

2

Calculate Network Boundary

Use bitwise AND logic between the IP and mask to find the first network IP.

3

Determine Assignable Range

Add 1 to the network address for the first host and subtract 1 from the broadcast for the last host.

Ready to Try It Yourself?

DocSwift processes everything directly on your device. Fast, safe, and completely free forever.

How helpful was this guide?

Rated 4.9 / 5 by 3,420+ users worldwide

Share with Colleagues & Friends

Help others protect their document privacy

Frequently Asked Questions

What is the difference between a /24 and /16 subnet?

A /24 subnet has 256 total IPs (254 usable hosts), whereas a /16 subnet provides 65,536 total IPs (65,534 usable hosts).

What is a /31 subnet used for?

Under RFC 3021, /31 subnets (2 total IPs) are specifically designed for point-to-point router links where network and broadcast addresses are unnecessary.