CIDR, short for Classless Inter-Domain Routing, is the method of allocating IP addresses and routing traffic using variable-length network prefixes instead of the fixed address classes of early IPv4. In internet addressing, CIDR also names the familiar notation 192.0.2.0/24, where the number after the slash states how many leading bits identify the network.
CIDR was introduced in 1993 to slow the exhaustion of IPv4 addresses and the explosive growth of global routing tables. By letting networks receive blocks sized to their needs and letting providers aggregate many customer blocks into one route, it became the foundation of modern IPv4 and IPv6 address management.
How CIDR notation and prefixes work
An IPv4 address has 32 bits and an IPv6 address has 128 bits. A CIDR prefix length /n fixes the first n bits as the network part; the remaining bits identify hosts or smaller subnets. A block therefore contains 2 to the power of (32 minus n) addresses in IPv4, so a /24 holds 256 addresses and a /20 holds 4,096.
The prefix is equivalent to a subnet mask written in dotted form: /24 equals 255.255.255.0, and /20 equals 255.255.240.0. A valid CIDR block must start on a boundary aligned with its size, which is why 10.0.16.0/20 is valid but 10.0.17.0/20 is not.
The most frequently used IPv4 prefix lengths and their sizes are listed below.
| Prefix | Subnet mask | Total addresses | Typical use |
|---|---|---|---|
| /8 | 255.0.0.0 | 16,777,216 | Large private range, legacy allocations |
| /16 | 255.255.0.0 | 65,536 | Campus or cloud virtual network |
| /24 | 255.255.255.0 | 256 | Office LAN, smallest common global route |
| /28 | 255.255.255.240 | 16 | Small server segment |
| /30 | 255.255.255.252 | 4 | Older point-to-point links |
| /31 | 255.255.255.254 | 2 | Point-to-point links without broadcast |
| /32 | 255.255.255.255 | 1 | Single host route, loopback |
In conventional IPv4 subnets, the first address identifies the network and the last is the broadcast address, so usable hosts equal the total minus two. Point-to-point /31 links and single-host /32 routes are the standard exceptions.
From classful addressing to CIDR
Before CIDR, IPv4 used classful addressing: the first bits of an address determined whether it belonged to class A, B or C, each with a fixed network size. Organizations needing a few thousand addresses received a class B with 65,536, wasting most of it, and every class C network required its own routing table entry.
| Aspect | Classful addressing | CIDR |
|---|---|---|
| Network sizes | Only /8, /16 or /24 | Any prefix length |
| Address efficiency | Large waste in fixed blocks | Blocks sized to actual need |
| Routing table growth | One entry per network | Aggregated into summary routes |
| Mask information | Implied by the address class | Carried explicitly with each route |
| Routing protocols | Classful protocols such as RIPv1 | Classless protocols such as BGP-4 and OSPF |
CIDR required routing protocols to carry the prefix length with every route. BGP version 4, the protocol that connects autonomous systems, was designed with this capability and remains the inter-domain routing protocol of the internet.
Route aggregation and longest prefix match
Route aggregation, also called supernetting or summarization, combines contiguous blocks into one shorter prefix. Four adjacent /24 networks from 198.51.100.0 to 198.51.103.255 can be announced as a single /22, so other networks need only one routing entry instead of four.
Routers choose among overlapping routes using longest prefix match: the most specific route that contains the destination wins. A router with routes for 203.0.113.0/24 and 203.0.113.128/25 sends traffic for 203.0.113.200 along the /25, which allows exceptions to coexist with broad summary routes.
Prefix length conventions also shape what the global routing system accepts. Most networks filter IPv4 announcements longer than /24 and IPv6 announcements longer than /48, so smaller blocks cannot be independently routed on the public internet.
CIDR in IPv6 and private address planning
IPv6 uses CIDR notation exclusively. The standard subnet is a /64, because stateless address autoconfiguration expects 64 host bits. Sites usually receive larger prefixes so they can create many /64 subnets without renumbering.
| Prefix | Address family | Common assignment |
|---|---|---|
| /32 | IPv6 | Initial allocation to an ISP |
| /48 | IPv6 | Organization or site, 65,536 subnets |
| /56 | IPv6 | Home or small business, 256 subnets |
| /64 | IPv6 | Single LAN segment |
| 10.0.0.0/8 | IPv4 private | Large internal and cloud networks |
| 172.16.0.0/12 | IPv4 private | Medium internal networks |
| 192.168.0.0/16 | IPv4 private | Home and small office networks |
Good CIDR planning reserves space for growth and summarization. Assigning each branch office a block from one contiguous range, such as consecutive /20 networks, lets the core network route all branches with a single summary prefix.
Common CIDR mistakes
Errors with CIDR are usually arithmetic or planning errors that surface much later, when networks must be connected or expanded.
- Overlapping ranges: two sites or cloud networks using the same private block cannot be connected by VPN or peering without translation.
- Misaligned blocks: a prefix that does not start on its size boundary is rejected or silently corrected.
- Undersized subnets: a /26 chosen for today’s devices runs out as the network grows.
- Confusing mask and prefix: a wildcard mask in access lists is the inverse of a subnet mask.
- Too-specific public routes: announcements longer than /24 or /48 are widely filtered and become unreachable.
Using an IP address management tool and documenting every allocation in a single plan prevents most overlaps and keeps aggregation possible.
The idea in brief
CIDR is a flexible way of slicing up internet addresses. Imagine a street where houses once came only in three fixed sizes, far too big or too small for most families. CIDR lets each block of addresses be cut to the size that is actually needed.
The number after the slash tells how big the block is. A bigger number means a smaller block. Routers can also treat many neighboring blocks as one. That keeps the internet’s road map short and manageable.
A practical scenario
A retail company with 40 stores is planning its network before moving to a cloud provider. Each store needs about 150 addresses for registers, cameras and Wi-Fi, and the cloud environment needs room for several thousand servers.
The network team reserves 10.40.0.0/16 for stores and gives each store a /24 with 254 usable addresses, numbered consecutively so all stores can be summarized as one route. The cloud receives the separate block 10.100.0.0/16, divided into /20 subnets for production, testing and management.
When the stores are connected to the cloud over VPN, there are no overlaps, the cloud routing table needs only one summary route for all 40 stores, and adding new stores requires no redesign.