What Is CIDR Notation, and Why Did It Replace Network Classes?
CIDR explained from first principles: what the slash number means, why classes A/B/C were abandoned, and how to read any prefix at a glance.
CIDR — Classless Inter-Domain Routing — is the reason modern addresses are written 10.0.0.0/8 rather than "a Class A network". The slash number is simply how many leading bits identify the network.
Before CIDR: the class system
Until 1993, the split between network and host was fixed by the first octet:
| Class | First octet | Network bits | Hosts per network |
|---|---|---|---|
| A | 1–126 | 8 | 16,777,214 |
| B | 128–191 | 16 | 65,534 |
| C | 192–223 | 24 | 254 |
The problem is visible in that last column. An organisation needing 500 addresses had two options: a Class C with 254 (too few), or a Class B with 65,534 — wasting 65,000 addresses. There was nothing in between.
By the early 1990s this was consuming the IPv4 space fast enough that exhaustion was projected within a few years.
What CIDR changed
CIDR removed the fixed boundaries. The prefix can be any length from 0 to 32, so a network can be sized to what it needs:
- 500 hosts →
/23(510 usable) - 100 hosts →
/25(126 usable) - 2 hosts →
/30(2 usable)
It also enabled route aggregation: four adjacent /24s can be advertised as a single /22, so the global routing table carries one entry instead of four. That aggregation is what kept internet routing tractable as the network grew.
Reading a prefix quickly
The prefix tells you the host bits: 32 − prefix. Host bits tell you the size: 2^host_bits.
| CIDR | Mask | Addresses |
|---|---|---|
| /8 | 255.0.0.0 | 16,777,216 |
| /16 | 255.255.0.0 | 65,536 |
| /24 | 255.255.255.0 | 256 |
| /26 | 255.255.255.192 | 64 |
| /30 | 255.255.255.252 | 4 |
Each extra bit in the prefix halves the network. Each bit removed doubles it.
Route aggregation, worked through
Aggregation is the half of CIDR that users never see and routers depend on. Four adjacent /24s —
10.1.0.0/24, 10.1.1.0/24, 10.1.2.0/24, 10.1.3.0/24
— cover 4 × 256 = 1,024 consecutive addresses, which is exactly a /22 (2³² ⁻ ²² = 1,024). Because the first block starts at 10.1.0.0 and 0 is a multiple of 4, they summarise cleanly as 10.1.0.0/22, mask 255.255.252.0. One routing entry replaces four.
The alignment condition is strict. The set 10.1.1.0/24 through 10.1.4.0/24 is also four consecutive /24s, but 1 is not a multiple of 4, so no single prefix covers it. You would need three entries: 10.1.1.0/24, 10.1.2.0/23 and 10.1.4.0/24. A block can only be summarised if it starts on a multiple of its own size — the same rule that governs subnetting, applied upward instead of downward.
This is why address plans that allocate in aligned power-of-two chunks produce short routing tables, and ad-hoc plans produce long ones.
Splitting a prefix
Going the other way is subtraction. To cut 198.51.100.0/24 into four pieces, add 2 bits (because 2² = 4) to get /26s, each 64 addresses:
| Subnet | Range |
|---|---|
| 198.51.100.0/26 | .0 – .63 |
| 198.51.100.64/26 | .64 – .127 |
| 198.51.100.128/26 | .128 – .191 |
| 198.51.100.192/26 | .192 – .255 |
Add 3 bits instead and you get eight /27s of 32 addresses. The number of subnets is always 2^(new prefix − old prefix).
Private space in CIDR terms
The reserved private ranges are defined as prefixes, and their sizes are worth knowing:
| Prefix | Addresses |
|---|---|
| 10.0.0.0/8 | 16,777,216 |
| 172.16.0.0/12 | 1,048,576 |
| 192.168.0.0/16 | 65,536 |
Note that 172.16.0.0/12 spans 172.16 through 172.31 — not 172.16 through 172.16.255 as is often assumed, and not all of 172.x either. The /12 is the unambiguous way to state it, which is a good illustration of why the notation won.
Where classes survive
Three places, and it is worth knowing which:
- Vocabulary. "A class C" usually just means a /24.
- Default masks. Some tools still assume a classful default when none is
given, which is why the subnet calculator offers a class selector.
- Multicast and reserved space. Class D (224–239) for multicast and Class E
(240–255) as reserved are still meaningful designations.
Critically, a prefix that disagrees with the address's historical class is entirely valid. 10.0.0.0/24 is a perfectly normal network even though 10.x is "Class A". That flexibility is the whole point of CIDR.
CIDR in IPv6
The same notation carries over, with 128 bits instead of 32. A /64 is the standard single-subnet allocation and a /48 a typical site allocation. A /48 contains 2^(64−48) = 65,536 /64 subnets, and a single /64 holds 2⁶⁴ = 18,446,744,073,709,551,616 addresses. Because one subnet already contains more addresses than the entire IPv4 internet squared, IPv6 subnetting is about hierarchy and documentation rather than conserving space — you divide on nibble boundaries (/52, /56, /60) because they line up with hex digits and stay readable. The IPv6 subnet calculator does the hex arithmetic.
Common misreadings
- Thinking a bigger number means a bigger network. It is the reverse: a /8 is
enormous, a /30 is four addresses.
- Treating /0 as meaningless.
0.0.0.0/0matches everything and is the
default route.
- Reading a /32 as a whole network. In IPv4 it is one address — a host route
or loopback. In IPv6, confusingly, a /32 is a large ISP allocation. The prefix length only means something relative to the address family's total bit count.
- Assuming the prefix must match the address block. It need not; that was the
point of abolishing classes.
For any prefix you are unsure of, the CIDR calculator will expand it to a mask, a range and a host count in one step.
Calculators used in this guide
More guides
- How EMI Is Calculated (And What Prepayment Actually Saves)The EMI formula worked through on a 25 lakh loan, why early instalments are mostly interest, and what tenure and prepayment really change.
- How to Calculate GST: Adding It, Removing It, and Splitting ItAdd GST to a base price, strip it out of an inclusive one, split a rate into CGST and SGST, and see why input tax credit changes the maths.
- How to Calculate Age Exactly in Years, Months and DaysThe borrowing method for exact age, how leap years and 29 February birthdays behave, and the month-end cases where two answers are both defensible.
