What Is CIDR?
CIDR stands for Classless Inter-Domain Routing. It's the modern system for specifying IP address ranges, replacing the old Class A/B/C scheme. You'll see CIDR notation everywhere: AWS VPCs, Kubernetes pod networks, firewall rules, Docker networks.
A CIDR address looks like this: 192.168.1.0/24
The number after the slash is the prefix length ā how many bits of the address are the network portion. The rest are host bits.
How the Prefix Length Works
An IPv4 address is 32 bits. If the prefix is /24, then:
- 24 bits = network address (fixed)
- 8 bits = host addresses (variable)
- 2āø = 256 total addresses, 254 usable (first = network, last = broadcast)
192.168.1.0/24
ā ā
ā āā 24 network bits, 8 host bits
āā Network address
Common Prefix Lengths at a Glance
| CIDR | Subnet Mask | Total IPs | Usable Hosts | Common Use |
|---|---|---|---|---|
| /8 | 255.0.0.0 | 16,777,216 | 16,777,214 | Large ISP, Class A private (10.x.x.x) |
| /16 | 255.255.0.0 | 65,536 | 65,534 | Medium network, 172.16.0.0/16 |
| /24 | 255.255.255.0 | 256 | 254 | Small LAN, single subnet |
| /25 | 255.255.255.128 | 128 | 126 | Half of /24 |
| /26 | 255.255.255.192 | 64 | 62 | Quarter subnet |
| /27 | 255.255.255.224 | 32 | 30 | Small segment |
| /28 | 255.255.255.240 | 16 | 14 | Tiny VLAN |
| /29 | 255.255.255.248 | 8 | 6 | Point-to-point + 4 hosts |
| /30 | 255.255.255.252 | 4 | 2 | Point-to-point links |
| /32 | 255.255.255.255 | 1 | 1 (host route) | Single host, loopback |
Private IP Address Ranges (RFC 1918)
These ranges are reserved for private networks and will never be routed on the public internet:
| Range | CIDR | Addresses | Common Use |
|---|---|---|---|
| 10.0.0.0 ā 10.255.255.255 | 10.0.0.0/8 | ~16.7M | Corporate LANs, AWS/GCP VPCs |
| 172.16.0.0 ā 172.31.255.255 | 172.16.0.0/12 | ~1M | Docker default bridge, some VPNs |
| 192.168.0.0 ā 192.168.255.255 | 192.168.0.0/16 | 65,536 | Home routers, small offices |
Rule of thumb: Use 10.x.x.x for cloud infrastructure (gives you flexibility), 192.168.x.x for local dev environments and home networks.
Subnetting: Breaking a Network into Smaller Pieces
When you have a /24 (256 IPs) and need 4 separate subnets for different teams or security zones, you subnet it by borrowing host bits:
192.168.1.0/24 ā split into 4 Ć /26 subnets
192.168.1.0/26 (0ā63) Hosts: 192.168.1.1ā62
192.168.1.64/26 (64ā127) Hosts: 192.168.1.65ā126
192.168.1.128/26 (128ā191) Hosts: 192.168.1.129ā190
192.168.1.192/26 (192ā255) Hosts: 192.168.1.193ā254
Each time you increase the prefix by 1, you halve the number of hosts and double the number of subnets.