What Is CIDR Notation?
CIDR (Classless Inter-Domain Routing) is a compact way to represent an IP address and its network mask: 192.168.1.0/24, 10.0.0.0/8, 0.0.0.0/0.
The number after the slash is the prefix length — how many bits are fixed (network part). The remaining bits are variable (host addresses).
How It Works
192.168.1.0/24
IP in binary: 11000000.10101000.00000001.00000000
|_____ 24 bits fixed _____|__ 8 bits variable __
/24 means:
- First 24 bits are the network:
192.168.1 - Last 8 bits vary:
0to255 - Total addresses: 2^8 = 256 (254 usable — .0 is network address, .255 is broadcast)
Quick formula:
- Total hosts = 2^(32 - prefix_length)
- Usable hosts = total - 2
Common CIDR Blocks
| CIDR | Usable IPs | Common use |
|---|---|---|
| /32 | 1 | Single IP (allowlist one host) |
| /30 | 2 | Point-to-point link |
| /28 | 14 | Very small subnet |
| /27 | 30 | Small team subnet |
| /26 | 62 | Small office |
| /25 | 126 | Half class C |
| /24 | 254 | Standard network (home, small office) |
| /22 | 1,022 | Medium network |
| /20 | 4,094 | Large subnet |
| /16 | 65,534 | Large organization |
| /8 | 16.7 million | Huge network |
| /0 | All | Entire internet ("allow all" in firewall) |
Private IP Ranges (RFC 1918)
Not routable on the public internet:
| CIDR | Range | Typical use |
|---|---|---|
| 10.0.0.0/8 | 10.x.x.x | Large corporate |
| 172.16.0.0/12 | 172.16.x.x – 172.31.x.x | Medium networks |
| 192.168.0.0/16 | 192.168.x.x | Home/office |
CIDR in Cloud Security Groups
# AWS Security Group inbound rules:
Allow SSH (22) from 203.0.113.0/24 → only your office can SSH
Allow HTTPS (443) from 0.0.0.0/0 → anyone on internet
Allow PostgreSQL (5432) from 10.0.0.0/16 → only VPC instances
VPC Subnet Design Example
VPC: 10.0.0.0/16 (65,536 addresses)
Public subnets:
10.0.1.0/24 (us-east-1a) — 254 hosts — load balancers
10.0.2.0/24 (us-east-1b) — 254 hosts
Private subnets:
10.0.10.0/24 (us-east-1a) — 254 hosts — app servers
10.0.11.0/24 (us-east-1b) — 254 hosts
Database subnets:
10.0.20.0/24 (us-east-1a) — 254 hosts — RDS
10.0.21.0/24 (us-east-1b) — 254 hosts
Calculating IP Range Manually
For 192.168.5.0/26:
- Hosts = 2^(32-26) = 2^6 = 64
- Usable = 62
- Network address = 192.168.5.0
- Broadcast = 192.168.5.63
- Usable range = 192.168.5.1 to 192.168.5.62
→ Calculate subnet ranges automatically with the IPv4 Subnet Calculator.