CIDR (Classless Inter-Domain Routing)
Classless Inter-Domain Routing (CIDR) describes IP network prefixes using an address followed by a slash and a prefix length, such as 192.0.2.0/24. The prefix length identifies how many leading address bits belong to the network prefix.
Reading a prefix
The number after the slash counts network-prefix bits. IPv4 addresses contain 32 bits, so a /24 prefix leaves eight bits outside the prefix. IPv6 uses the same notation with 128-bit addresses; the address-family distinction matters when interpreting a prefix length.
192.0.2.0/24 identifies the IPv4 range from 192.0.2.0 through 192.0.2.255. The corresponding contiguous subnet mask is 255.255.255.0. Writing a host as 192.0.2.75/24 describes its address and prefix length; the network prefix is still 192.0.2.0/24.
Worked IPv4 examples
| Prefix | Addresses in the block | Meaning |
|---|---|---|
192.0.2.0/24 | 256 | A block covering the full last octet |
192.0.2.64/26 | 64 | The range 192.0.2.64–192.0.2.127 |
192.0.2.75/32 | 1 | One exact IPv4 address |
0.0.0.0/0 | All IPv4 addresses | The least-specific IPv4 prefix |
For a /26, the final six bits vary: 2^6 = 64 addresses. 192.0.2.75 belongs to the block beginning at .64, not the block beginning at .0 or .128.
The number of addresses in a block is not always the number assignable to hosts. Traditional IPv4 broadcast subnets reserve network and broadcast addresses; /31 point-to-point links and /32 host routes have different uses.
Why CIDR appears in routing
Variable prefix lengths allow networks to be divided and aggregated without the old address-class boundaries. A router can hold a broad aggregate alongside a more-specific route. For an ordinary destination lookup within a selected routing table, a matching /26 is more specific than a matching /24.
Common confusions
A larger prefix-length number means a smaller address block. A CIDR string is not a range written as start and end addresses, and it does not imply that every address has been assigned. Seeing a service advertised as /32 does not mean the surrounding physical network must also use /32 interface prefixes.