The Complete Guide to CIDR Notation and Subnet Calculation

The Complete Guide to CIDR Notation and Subnet Calculation

CIDRSubnetNetworking

The Complete Guide to CIDR Notation and Subnet Calculation

If you’ve ever configured a firewall rule, set up a VPC, or managed a server, you’ve encountered notation like 192.168.1.0/24 or 10.0.0.0/8. This is CIDR (Classless Inter-Domain Routing) notation — the standard way to describe IP address ranges. Understanding CIDR is essential for network design, security configuration, and cloud infrastructure management.

This guide covers CIDR from its historical origins through practical subnet calculations, with reference tables and worked examples.

Classful vs. Classless: Why CIDR Exists

The Classful Era (1981–1993)

In the early internet, IP addresses were allocated in fixed classes:

ClassLeading BitsNetwork BitsRangeHosts
A081.0.0.0 – 126.0.0.016,777,214
B1016128.0.0.0 – 191.255.0.065,534
C11024192.0.0.0 – 223.255.255.0254

The problem was obvious. An organization needing 500 hosts couldn’t use a Class C (254 hosts) but would waste most of a Class B (65,534 hosts). This rigid allocation scheme accelerated IPv4 address exhaustion.

The CIDR Revolution (1993–Present)

RFC 1518 and RFC 1519 introduced CIDR in 1993, abolishing class boundaries. Instead of fixed allocations, CIDR uses a prefix length to specify exactly how many addresses are needed:

# Classful: Class C = always 256 addresses
192.168.1.0 (Class C)

# CIDR: flexible allocation
192.168.1.0/25  → 128 addresses
192.168.1.0/26  → 64 addresses
192.168.1.0/28  → 16 addresses

CIDR also enabled route aggregation (supernetting), dramatically reducing the size of global routing tables.

Understanding Prefix Length

The number after the slash (/) in CIDR notation represents the number of bits in the network portion of the address. Since IPv4 addresses are 32 bits total, the remaining bits identify individual hosts.

192.168.1.0/24

IP address:    11000000.10101000.00000001.00000000
Subnet mask:   11111111.11111111.11111111.00000000
               ←── network (24 bits) ──→←host (8)→

Total addresses: 2^8 = 256
Usable hosts:   256 - 2 = 254 (subtract network and broadcast)

Key formulas:

Every increment of 1 in the prefix length halves the address space.

Subnet Mask ↔ CIDR Reference Table

This is the table you’ll reference most often in practice:

CIDRSubnet MaskTotal AddressesUsable HostsCommon Use
/32255.255.255.25511Single host route
/31255.255.255.25422*Point-to-point link
/30255.255.255.25242Point-to-point link
/29255.255.255.24886Small subnet
/28255.255.255.2401614Small LAN
/27255.255.255.2243230Small office
/26255.255.255.1926462Medium LAN
/25255.255.255.128128126Medium network
/24255.255.255.0256254Standard LAN
/23255.255.254.0512510Large LAN
/22255.255.252.01,0241,022Campus network
/21255.255.248.02,0482,046Large subnet
/20255.255.240.04,0964,094ISP allocation
/16255.255.0.065,53665,534Enterprise/ISP
/8255.0.0.016,777,21616,777,214Mega network

*/31 subnets use both addresses per RFC 3021 — no network or broadcast address is reserved.

Calculating Network Address, Broadcast, and Host Range

The core of subnet math involves finding three values for any given IP and prefix length.

Worked Example

Let’s calculate the subnet details for 192.168.1.130/26.

Step 1: Determine the block size

/26 → Host bits = 32 - 26 = 6
Block size = 2^6 = 64

Step 2: Find the network address

Divide the last octet by the block size and round down:

130 ÷ 64 = 2.03... → 2 × 64 = 128
Network address: 192.168.1.128

Step 3: Find the broadcast address

Network address + block size - 1:

128 + 64 - 1 = 191
Broadcast address: 192.168.1.191

Step 4: Determine the usable host range

First host: 192.168.1.129 (network + 1)
Last host:  192.168.1.190 (broadcast - 1)
Usable:     62 hosts

Summary

FieldValue
Input IP192.168.1.130/26
Network address192.168.1.128
First usable host192.168.1.129
Last usable host192.168.1.190
Broadcast address192.168.1.191
Usable hosts62

Practical Examples

Example 1: /24 — Standard Office Network

Network: 10.0.1.0/24
Subnet mask: 255.255.255.0
Host range: 10.0.1.1 – 10.0.1.254
Broadcast: 10.0.1.255
Usable: 254 hosts

The most common subnet in practice. Suitable for small to medium offices, and the default for most home routers.

Example 2: /16 — Enterprise Network

Network: 172.16.0.0/16
Subnet mask: 255.255.0.0
Host range: 172.16.0.1 – 172.16.255.254
Broadcast: 172.16.255.255
Usable: 65,534 hosts

Used by large organizations and data centers. Typically further divided into /24 or /23 subnets for departments or services.

Example 3: /8 — Mega Network

Network: 10.0.0.0/8
Subnet mask: 255.0.0.0
Host range: 10.0.0.1 – 10.255.255.254
Broadcast: 10.255.255.255
Usable: 16,777,214 hosts

The largest RFC 1918 private address block. Commonly used as the default network in cloud environments (AWS VPC, GCP VPC, Azure VNet).

Example 4: VLSM — Variable Length Subnet Masking

In practice, networks are divided into subnets of varying sizes to match actual requirements:

Original: 192.168.10.0/24 (254 hosts)

Divided:
├── 192.168.10.0/26   → Server farm (62 hosts)
├── 192.168.10.64/26  → Development team (62 hosts)
├── 192.168.10.128/27 → Sales team (30 hosts)
├── 192.168.10.160/27 → Admin team (30 hosts)
├── 192.168.10.192/28 → Guest Wi-Fi (14 hosts)
└── 192.168.10.208/28 → Network infrastructure (14 hosts)
    192.168.10.224/27 → Reserved for future use

CIDR in IPv6

IPv6 also uses CIDR notation, but with 128-bit addresses:

2001:db8::/32       → ISP allocation
2001:db8:abcd::/48  → Site (customer) allocation
2001:db8:abcd:1::/64 → Single subnet (standard)

In IPv6, /64 is the standard subnet size. With 64 host bits, a single subnet can accommodate approximately 1.8 x 10^19 addresses, making address conservation through subnetting effectively unnecessary.

Common Mistakes

1. Assigning the Network Address to a Host

In 192.168.1.0/24, the .0 address is the network identifier — don’t assign it to a device. While some operating systems tolerate this, it violates standards and can cause routing issues.

2. Ignoring Subnet Boundaries

The network address for 192.168.1.100/26 is .64, not .0. The broadcast is .127, not .255. Always calculate based on the block size for the given prefix length.

3. Confusing /32 and /0

Mixing these up in firewall rules can create serious security vulnerabilities. A rule allowing 0.0.0.0/0 permits traffic from every IP on the internet.

Make CIDR Calculations Easier

Manual subnet math gets tedious fast. Use the CIDR calculator on ip.utilo.kr to instantly compute network addresses, broadcast addresses, host ranges, and subnet masks from any CIDR notation.

For a refresher on IP address fundamentals, see our Complete Guide to IP Addresses.

Open CIDR Calculator →

한국어로 읽기 →
AD

Professional Matching — Diamatch

Trust of a matchmaker + convenience of an app

Get Started

Related Posts