← All guides
IPv4 / Routing

CIDR Notation Explained: From /8 to /32

CIDR is the compact way network engineers describe IPv4 prefixes. This guide covers prefix length, masks, address ranges, route summarization and longest-prefix matching.

Reference guide · CIDR · Routing · Addressing

What Does CIDR Mean?

CIDR stands for Classless Inter-Domain Routing. Instead of relying on the old class A/B/C model, CIDR describes an IPv4 network with an address followed by a prefix length, such as 10.20.0.0/16.

The number after the slash tells you how many of the 32 IPv4 bits belong to the network prefix.

Prefix Length and Subnet Mask

A prefix length can be represented as a dotted-decimal subnet mask. For example:

CIDRSubnet maskHost bitsTotal addresses
/8255.0.0.02416,777,216
/16255.255.0.01665,536
/24255.255.255.08256
/25255.255.255.1287128
/26255.255.255.192664
/27255.255.255.224532
/28255.255.255.240416
/30255.255.255.25224
/32255.255.255.25501

How Prefix Length Controls the Range

IPv4 has 32 bits. A /24 uses 24 bits for the prefix, leaving eight host bits. A /16 leaves 16 host bits, so its address space is much larger.

The total number of addresses is:

2^(32 - prefix length)

For 172.16.0.0/20:

32 - 20 = 12 host bits
2^12 = 4096 addresses

Finding the Network from an IP/CIDR

Example: 10.10.37.84/20

The mask is 255.255.240.0. The third-octet block size is 256 - 240 = 16. Valid network boundaries are 0, 16, 32, 48, ...

37 falls into the 32–47 block, so the network is 10.10.32.0/20.

The range is 10.10.32.0 through 10.10.47.255.

CIDR and Route Summarization

CIDR is particularly useful for summarizing multiple contiguous prefixes into a shorter route. For example, four adjacent /24 networks can potentially be summarized as one /22 if they are aligned correctly.

Consider:

These can be represented by 10.20.0.0/22. The summary covers 1024 addresses.

Summarization reduces routing-table entries and can make routing domains easier to operate, but the summary must not unintentionally include address space that belongs somewhere else.

Longest Prefix Match

When multiple routes match a destination, routers generally select the most specific matching prefix — the route with the longest prefix length.

10.0.0.0/8

10.20.0.0/16

10.20.30.0/24

For destination 10.20.30.45, all three routes match, but /24 is the most specific and therefore wins the longest-prefix comparison.

CIDR Is Not the Same as a VLAN

A CIDR prefix describes an IP address range. A VLAN is a Layer 2 segmentation mechanism. They are commonly associated — for example, one VLAN may use 192.168.50.0/24 — but they are not inherently the same thing.

A routed interface can have a CIDR prefix without being a traditional access VLAN, and a Layer 2 VLAN can exist before an IP subnet is assigned to it.

Private IPv4 CIDR Blocks

RFC 1918 defines three IPv4 ranges reserved for private internetworks:

RangeCIDRAddresses
10.0.0.0 – 10.255.255.255/816,777,216
172.16.0.0 – 172.31.255.255/121,048,576
192.168.0.0 – 192.168.255.255/1665,536

Private addressing is common inside enterprise networks, but private does not mean globally routable. Internet access normally requires some form of translation, proxying or another edge mechanism.

/31 and /32

Two prefixes deserve special attention in operational networks.

/31: RFC 3021 defines the use of /31 prefixes on point-to-point links. The two addresses can both be used by the endpoints, avoiding the traditional network/broadcast waste.

/32: A /32 identifies exactly one IPv4 address. It is commonly used for host routes, loopbacks and specific routing entries.

Practical CIDR Checklist

  1. Identify the prefix length.
  2. Convert it to a mask if needed.
  3. Determine the host-bit count.
  4. Calculate total address capacity.
  5. Find the correct network boundary.
  6. Check whether the range overlaps existing allocations.
  7. For routing, verify whether the prefix is more or less specific than competing routes.

Use the NetOpsBench IP / CIDR Explorer

Inspect a parent network, calculate child subnets and explore address ranges without doing the prefix math manually.

Open NetOpsBench →

FAQ

Does a larger CIDR number mean a larger network?

No. A larger prefix length means more bits are fixed as the network prefix and therefore fewer host addresses. A /28 is smaller than a /24.

What is the difference between /24 and 255.255.255.0?

They describe the same prefix. CIDR notation is simply the compact form.

Why can't any IP address be used as a network address?

The network address must have all host bits set to zero for that prefix. The valid boundaries therefore depend on the prefix length.

References: RFC 4632 (CIDR), RFC 1812 (IPv4 routing requirements), RFC 1918 (private address space), RFC 3021 (/31 point-to-point addressing).