CIDR Calculator
Convert between CIDR notation and subnet masks. Quick reference table for all CIDR ranges.
You May Also Like
What is CIDR?
CIDR (Classless Inter-Domain Routing) is a method for allocating IP addresses and routing Internet Protocol packets. It replaced the old "classful" system in 1993.
Think of CIDR like zip codes for the internet. Instead of rigid city boundaries, you can define neighborhoods of any size you need.
The notation looks like: 192.168.1.0/24
192.168.1.0is the network address/24means the first 24 bits identify the network
CIDR vs Subnet Mask
CIDR and subnet masks express the same thing differently:
| CIDR | Subnet Mask | Meaning |
|---|---|---|
| /8 | 255.0.0.0 | First 8 bits = network |
| /16 | 255.255.0.0 | First 16 bits = network |
| /24 | 255.255.255.0 | First 24 bits = network |
| /32 | 255.255.255.255 | Single host |
Why CIDR is preferred:
- Shorter to write (
/24vs255.255.255.0) - Easier to calculate mentally
- Better represents what's happening at the binary level
Quick conversion: Each octet of 255 in the subnet mask = 8 bits in CIDR. So 255.255.255.0 = /24 (8+8+8=24).
Common CIDR Block Sizes
๐ Home & Small Office:
- /24 (254 hosts) โ Most common for home networks
- /25 (126 hosts) โ When you need to split a /24 in half
- /26 (62 hosts) โ Small office networks
๐ข Enterprise:
- /16 (65,534 hosts) โ Department or building
- /8 (16 million hosts) โ Very large organizations
๐ Point-to-Point:
- /30 (2 hosts) โ Traditional router-to-router links
- /31 (2 hosts) โ Modern point-to-point (RFC 3021)
- /32 (1 host) โ Loopback or host routes
Understanding the Binary Math
The "magic" of CIDR is all about binary:
IP Address: 192.168.1.100
Binary: 11000000.10101000.00000001.01100100
/24 Mask: 11111111.11111111.11111111.00000000
^^^^^^^^ ^^^^^^^^ ^^^^^^^^ --------
Network portion Host portion
The 1s in the mask = network bits (fixed) The 0s in the mask = host bits (variable)
Hosts = 2^(host bits) - 2
For /24: Host bits = 32 - 24 = 8 Hosts = 2^8 - 2 = 254
We subtract 2 because the first address (network) and last address (broadcast) are reserved. Exception: /31 and /32 don't follow this rule.
Supernetting (Route Aggregation)
CIDR enables supernetting โ combining multiple smaller networks into one larger route:
Before supernetting (4 routes):
- 192.168.0.0/24
- 192.168.1.0/24
- 192.168.2.0/24
- 192.168.3.0/24
After supernetting (1 route):
- 192.168.0.0/22
This reduces routing table size and improves router performance. ISPs use this extensively to manage the internet's routing infrastructure.
Practical CIDR Tips
1. Memorize the Power of 2
- /24 = 256 addresses (254 usable)
- /25 = 128 addresses (126 usable)
- /26 = 64 addresses (62 usable)
- Each increment halves the size!
2. Boundary Alignment Matters Networks must start on appropriate boundaries. A /24 must start at .0, a /25 can start at .0 or .128.
3. Use /32 for Host Routes When you need to route traffic to a single IP (load balancers, anycast), use /32.
4. Document Your Allocations Use an IPAM (IP Address Management) tool or spreadsheet to track CIDR allocations.
5. Leave Room for Growth If you need 100 hosts, use /25 (126 usable) not /26 (62 usable). Networks always grow!