Back to Learning Hub
NETWORKING September 11, 2026 · 10 min read · 18K/mo

CIDR Subnet Math Explained: /24, /16, /8, and Everything Between

CIDR notation is how modern networks are described: an IP address plus a slash and a number counting the network-prefix bits. Everything left of the boundary is the network; everything right is the host. The math is simpler than the notation makes it look.

D
DomainScan Team
DomainScan
Share
NETWORKING

CIDR (Classless Inter-Domain Routing, RFC 4632) is how every modern network is described. An IP address followed by a slash and a number — the prefix length — telling you how many bits at the front of the address name the network.

Old school: class A, B, C. Modern: CIDR. All the sizing is one number.

The Notation

192.168.1.0/24
   ↑ IP    ↑ prefix length
  • Prefix length = network bits (leftmost)
  • Remaining bits = host bits (rightmost)
  • Total is always 32 bits (IPv4) or 128 bits (IPv6)

For IPv4 /24: 24 network bits + 8 host bits = 256 total addresses.

The Formulas

Total addresses  = 2^(32 - prefix)
Usable hosts     = 2^(32 - prefix) - 2   (subtract network + broadcast)

Subtract 2 because:

  • All-host-bits-zero is the network address (192.168.1.0 for /24)
  • All-host-bits-one is the broadcast address (192.168.1.255 for /24)

Neither can be assigned to a host.

Common Prefixes (IPv4)

PrefixTotalUsableCommon use
/816,777,21616,777,214Historic Class A, 10.0.0.0/8 RFC 1918
/1665,53665,534Large enterprise site, 172.16.0.0/12 RFC 1918 (in slices)
/24256254Office LAN, 192.168.x.0/24 RFC 1918
/266462Small department
/281614Small office DMZ
/2986Firewall interconnect
/3042Classic point-to-point link
/3122Modern p2p link (RFC 3021)
/3211Single host route

Splitting a Subnet

Add bits to the prefix. Each added bit halves the address space.

Example: split 192.168.1.0/24 into four subnets.

  • /24/26 (add 2 prefix bits = 4 subnets)
  • Each /26 has 64 addresses (62 usable)
  • Subnet boundaries: .0, .64, .128, .192
192.168.1.0/26     → 192.168.1.0   – 192.168.1.63
192.168.1.64/26    → 192.168.1.64  – 192.168.1.127
192.168.1.128/26   → 192.168.1.128 – 192.168.1.191
192.168.1.192/26   → 192.168.1.192 – 192.168.1.255

Reading a CIDR Block by Hand

To find the network address of 172.16.42.137/20:

  1. /20 = 20 network bits = 12 host bits
  2. Convert the host portion of the IP to binary
  3. Zero out the host bits

Faster method: the network boundary in /20 falls on multiples of 2^(32-20) / 256 = 16 in the third octet. 172.16.42.x — the closest multiple of 16 at or below 42 is 32. So the network is 172.16.32.0/20, covering 172.16.32.0172.16.47.255.

The /31 and /32 Special Cases

  • /31 — RFC 3021 lets you use /31 for point-to-point links with 2 usable addresses. No network / broadcast concept. Saves address space vs /30.
  • /32 — a single-host “subnet”. Used for loopback interfaces, host routes, and single-IP firewall matches.

IPv6 CIDR

Same notation, different bit widths. Common IPv6 prefixes:

PrefixCommon use
/48Site allocation
/64Standard LAN (per SLAAC)
/128Single host

There’s no shortage of IPv6 addresses — you don’t fret about /28 vs /29 the way you do with IPv4.

RFC 1918 Private Ranges

Reserved for internal use, never routed on the internet:

  • 10.0.0.0/8 — one giant private range
  • 172.16.0.0/12 — 16 /16s (172.16.0.0 to 172.31.255.255)
  • 192.168.0.0/16 — 256 /24s

Tools

Use the subnet calculator to:

  • Convert between CIDR and dotted netmask
  • List all subnets when splitting a block
  • Calculate first / last host, network, broadcast
  • Compute available host count

Cheaper than doing the math by hand every time.

Check the Port 25 glossary entry, read the What Is a MAC Address? deep dive, and browse DNS record types — CIDR is what routes IP packets that DNS lookups return.

Common Questions

01

What does /24 mean in an IP address?

The /24 tells you how many bits at the front of the IP address are the network portion. /24 = first 24 bits are the network, remaining 8 bits are the host — giving 256 total addresses (254 usable, since the first is the network address and the last is broadcast). Example: 192.168.1.0/24 covers 192.168.1.0 through 192.168.1.255.

02

How many hosts fit in a /16?

65,536 total addresses; 65,534 usable. Formula: 2^(32 - prefix). For /16 that's 2^16 = 65,536. Subtract 2 for the network address (all-host-bits-zero) and broadcast (all-host-bits-one), which cannot be assigned to hosts.

03

How do I split a /24 into four subnets?

Add 2 bits to the prefix: /24 becomes /26. Each /26 covers 64 addresses (62 usable). For 192.168.1.0/24 the four subnets are 192.168.1.0/26, 192.168.1.64/26, 192.168.1.128/26, and 192.168.1.192/26.

04

What is the difference between /30 and /31?

/30 has 4 addresses (2 usable) — classic point-to-point link with 2 hosts, 1 network, 1 broadcast. /31 (RFC 3021, 2000) redefines the semantics: only 2 addresses, both are usable, no network / broadcast — a modern point-to-point link with zero waste. Most modern routers support /31 for backbone links to conserve address space.

05

Is /32 a valid subnet?

Yes — a /32 is a single-host 'subnet' with exactly one address. Used for loopback interfaces, host routes in routing tables, and firewall rules matching a single IP. It's not a subnet in the traditional sense of holding multiple hosts, but the notation is valid and common.

#networking#ip-&-network#dns#domainscan
D
DomainScan Team
Writes about DNS infrastructure, email authentication, domain security, and the engineering behind automated domain intelligence.