Reading CIDR notation: what /24 and /16 actually mean

4 min read

CIDR notation like 192.168.1.0/24 shows up everywhere — router config, AWS VPC subnet design, firewall rules. The basics are quick, but /27 and /19 are the kind of thing you keep recalculating. This article walks through CIDR with the prefix sizes you actually deal with.

CIDR in context: replacing class-based addressing

CIDR (Classless Inter-Domain Routing) was introduced in RFC 1519 in 1993 to express IP allocations by prefix length.

Before CIDR, addresses were classful: the first bits of the address fixed the network portion size:

  • Class A — 8-bit network (about 16.7 million hosts max)
  • Class B — 16-bit network (about 65 thousand hosts max)
  • Class C — 24-bit network (254 hosts max)

This was too coarse. Organizations with a few thousand hosts that received a Class B wasted most of their 65k-address allocation. CIDR fixes this by allowing any prefix length between 0 and 32.

Notation: <address>/<prefix length>

192.168.1.0/24
└──────┬──┘ └┬┘
   starting   prefix length
   address    (network bits)
  • IPv4 addresses are 32 bits.
  • /24 means “the first 24 bits are the network portion, the last 8 are for hosts”.
  • Host bits = 32 − 24 = 8, so 2^8 = 256 candidate addresses.

Mapping to subnet masks

CIDR prefix length is equivalent to the older subnet mask form:

CIDRSubnet maskNetwork bitsHost bitsCandidate hosts
/8255.0.0.08 bit24 bit16,777,216
/16255.255.0.016 bit16 bit65,536
/24255.255.255.024 bit8 bit256
/27255.255.255.22427 bit5 bit32
/30255.255.255.25230 bit2 bit4
/32255.255.255.25532 bit0 bit1

A mask like 255.255.255.224 arises because:

  • /27 = 27 leading 1s, 5 trailing 0s.
  • 27 = 24 + 3, so the last octet is 11100000 = 224.

Usable hosts: subtract two

“Candidate” and “usable” host counts differ by two. Each subnet reserves two addresses for special meaning:

  • Network address (all-zero host bits) — names the subnet itself.
  • Broadcast address (all-one host bits) — broadcasts to every host in the subnet.
For 192.168.1.0/24:
  192.168.1.0   ← network address (cannot assign)
  192.168.1.1   ← first usable host
  ...
  192.168.1.254 ← last usable host
  192.168.1.255 ← broadcast (cannot assign)

Usable hosts: 256 − 2 = 254

Two exceptions: /31 and /32. /31 reserves both addresses for point-to-point links, and /32 is a single-host designation.

Prefix size cheat sheet

Sizes you will run into in practice:

CIDRWhere you see it
/8ISP-scale; the entire 10.0.0.0/8 private range
/16Whole organization; 192.168.0.0/16 private range; default AWS VPC size
/20Large subnet; ~4096 addresses
/24Department or VLAN; 256 addresses (254 usable)
/27Small LAN or VPN; 32 addresses (30 usable)
/29Endpoints of a leased line; 8 addresses (6 usable)
/30Point-to-point link; 4 addresses (2 usable)
/32Single host; common in firewall ACLs

The mental shortcut: /24 has 254 hosts; each step down doubles the count. Each step up halves it.

Subnet design pitfalls

1. Boundaries must align with the prefix

A /27 (32 addresses) must start at an octet ending that is a multiple of 32:

  • 192.168.1.0/27 → fine (boundaries at 0, 32, 64, …)
  • 192.168.1.16/27 → invalid (16 is not a multiple of 32)

CIDR assumes the address aligns with the prefix length.

2. AWS VPC reserves five addresses, not two

Inside an AWS VPC subnet, five addresses are reserved (the first four and the last one):

For 10.0.0.0/24 in AWS:
  10.0.0.0    network
  10.0.0.1    VPC router
  10.0.0.2    DNS
  10.0.0.3    future use
  10.0.0.255  broadcast
  → usable hosts: 256 − 5 = 251

A /24 that gives you 254 hosts on-prem gives you 251 in AWS. Cutting /29 or smaller in AWS leaves only 3 usable addresses, which is rarely workable. AWS’s practical floor is /28 (16 addresses, 11 usable).

3. You typically can’t resize a subnet

In most cloud environments, changing a subnet’s prefix length means recreating it. Size with some headroom up front rather than expecting to grow.

Summary

CIDR is “how many leading bits are network bits”. Once that’s internalized, the rest is mental arithmetic.

When you actually need address ranges, host counts, and subnet masks computed for an arbitrary CIDR, the calculator on this site does it instantly. Especially useful for /27 and below, where the math is easy to get wrong.