CIDR (Classless Inter-Domain Routing) is a compact way of describing an IP network.
Instead of using a subnet mask, CIDR specifies how many bits belong to the network portion of an IP address.
Example:
192.168.1.25/24
Here:
Originally, IPv4 used fixed address classes (Class A, B, and C).
This approach wasted many IP addresses and made routing inefficient.
CIDR was introduced to:
Today, CIDR is the standard method for describing IP networks.
The number after the slash indicates how many bits belong to the network.
Example:
192.168.1.25/24
means:
Visually:
IP Address 192.168.1.25 ↓ 11000000.10101000.00000001.00011001 Network Bits 11111111.11111111.11111111 Host Bits 00000000
CIDR notation and subnet masks describe exactly the same thing.
| CIDR | Subnet Mask |
|---|---|
| /8 | 255.0.0.0 |
| /16 | 255.255.0.0 |
| /24 | 255.255.255.0 |
| /25 | 255.255.255.128 |
| /26 | 255.255.255.192 |
| /27 | 255.255.255.224 |
| /28 | 255.255.255.240 |
| /29 | 255.255.255.248 |
| /30 | 255.255.255.252 |
| /32 | 255.255.255.255 |
CIDR notation is shorter and is therefore preferred today.
Example 1:
192.168.1.0/24
This represents one subnet containing:
Example 2:
10.0.0.0/8
A very large network containing over 16 million IPv4 addresses.
Example 3:
203.0.113.17/32
Represents exactly one IPv4 address.
CIDR is also used with IPv6.
Example:
2001:db8::/32
Most local IPv6 networks use:
/64
Unlike IPv4, IPv6 almost always uses prefix notation rather than subnet masks.
CIDR allows networks of almost any size.
Instead of allocating only fixed-size networks, administrators can choose the most appropriate prefix.
Benefits include:
Routers use CIDR prefixes when selecting routes.
Example:
Destination 192.168.10.25 Routing Table 192.168.0.0/16 192.168.10.0/24 0.0.0.0/0
The router chooses the longest matching prefix.
In this example:
192.168.10.0/24
is selected because it is more specific than:
192.168.0.0/16
This is known as the Longest Prefix Match rule.
Several Telenegar tools display or use CIDR notation.
Subnet Calculator can convert between:
cidr subnet subnetting ipv4 ipv6 routing networking