Skip to content
Networking

Complete Guide to IPv4 Subnetting with CIDR

Written and reviewed by Miguel Iglesias Valenzuela

Lead editor & developer

Last updated: September 11, 2026

Contact us

Subnetting is the process of dividing a single IP network into smaller, more manageable segments called subnets. Whether you are configuring a home router, planning a corporate network, or preparing for a Cisco CCNA exam, understanding IPv4 subnetting with CIDR notation is a fundamental skill for any network engineer or system administrator.

Why Subnetting Matters

Every device on an IPv4 network needs a unique address. Without subnetting, all devices would share a single broadcast domain, meaning every packet would be seen by every device. This causes three problems:

  • Broadcast storms — too much broadcast traffic degrades performance.
  • Security — all devices sit on the same segment, making isolation impossible.
  • Address waste — a /8 network has 16.7 million addresses but most organizations only need hundreds or thousands.

Subnetting solves all three by splitting a large network into smaller blocks, each with its own network address, broadcast address, and range of usable hosts.

IPv4 Address Structure

An IPv4 address is a 32-bit number written as four decimal octets separated by dots. For example, 192.168.1.100 is actually the binary number:

11000000.10101000.00000001.01100100

Each octet ranges from 0 to 255 (8 bits). The total space is 2³² = 4,294,967,296 unique addresses. To manage this space efficiently, addresses are split into two parts: network bits (the prefix) and host bits (the suffix).

CIDR Notation Explained

CIDR (Classless Inter-Domain Routing) replaced the old classful system (Class A/B/C) in 1993 and is defined in RFC 4632. CIDR notation appends a slash and a number to an IP address indicating how many bits form the network prefix:

192.168.1.0/24

The first 24 bits = network, remaining 8 bits = hosts

A /24 subnet gives you 2⁸ − 2 = 254 usable host addresses (the minus 2 accounts for the network address and the broadcast address, which cannot be assigned to devices).

Common Subnet Sizes

CIDRSubnet MaskTotal AddressesUsable Hosts
/30255.255.255.25242
/29255.255.255.24886
/28255.255.255.2401614
/27255.255.255.2243230
/26255.255.255.1926462
/25255.255.255.128128126
/24255.255.255.0256254
/23255.255.254.0512510
/22255.255.252.01,0241,022
/16255.255.0.065,53665,534
/8255.0.0.016,777,21616,777,214

Worked Example: Subnetting 192.168.1.0/24

Suppose you have the network 192.168.1.0/24 and need to split it into four equal subnets for four departments. You need 2 extra bits (2² = 4 subnets), which changes the prefix from /24 to /26.

Subnet 1: 192.168.1.0/26 → range 192.168.1.1 – 192.168.1.62 (62 hosts)

Subnet 2: 192.168.1.64/26 → range 192.168.1.65 – 192.168.1.126 (62 hosts)

Subnet 3: 192.168.1.128/26 → range 192.168.1.129 – 192.168.1.190 (62 hosts)

Subnet 4: 192.168.1.192/26 → range 192.168.1.193 – 192.168.1.254 (62 hosts)

Each subnet has a subnet mask of 255.255.255.192 (/26) and provides 62 usable host addresses. The broadcast addresses are .63, .127, .191, and .255 respectively.

Special Cases: /31 and /32

RFC 3021 defines /31 subnets for point-to-point links (e.g., a direct router-to-router connection). A /31 subnet has only 2 addresses and eliminates the wasted network and broadcast addresses. This is standard practice in modern ISP and data-center networks.

A /32 address represents a single host. It is commonly used for loopback interfaces (127.0.0.1/32), host routes in routing tables, and VPN tunnel endpoints where one address must be reached through a specific path.

Wildcard Masks

A wildcard mask is the bitwise inverse of a subnet mask. Where a subnet mask of 255.255.255.0 means "match these bits," its wildcard 0.0.0.255 means "ignore these bits." Wildcard masks appear primarily in Cisco ACLs (access control lists) and OSPF network statements, but the math is straightforward: subtract each octet from 255.

Converting Between Notations

Beyond CIDR, IP addresses can be expressed as a single decimal integer (useful in programming) or in hexadecimal (visible in packet captures). For example, 192.168.1.1 is 3,232,235,777 in decimal or C0A80101 in hex. You can use a decimal-to-IPv4 converter to test these conversions interactively.

Splitting a Range into CIDR Blocks

Sometimes you have an arbitrary IP range (e.g., 10.0.0.50 – 10.0.0.120) and need to represent it as CIDR blocks. Not every range can be expressed as a single CIDR block — CIDR blocks must be power-of-two aligned. The algorithm: find the largest CIDR block that fits at the start of the range, then recurse on the remainder. An IP range calculator automates this process.

Practical Tips for Network Engineers

  • Document everything — maintain a subnet spreadsheet with VLAN assignments, gateway addresses, and DHCP ranges.
  • Plan for growth — allocate /24s even for small departments to avoid painful re-subnetting later.
  • Use private ranges — RFC 1918 (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16) for internal networks.
  • Reserve space — leave room for management interfaces, VPN pools, and IoT segments.

Try It Yourself

Use our free online tools to practice what you learned:

  • Subnet Calculator — enter any CIDR and see the network, broadcast, wildcard, and binary breakdown.
  • CIDR Calculator — convert between CIDR prefix length, subnet mask, and wildcard mask.
  • IP Range Calculator — split any IP range into optimal CIDR blocks.

References