Skip to main content

CIDR Calculator

Convert between CIDR notation, subnet masks, and IP ranges. Calculate network details with cloud provider support, supernet detection, and reverse IP-to-CIDR conversion.

CIDR Tips

  • CIDR /24 is the most common — equivalent to the old Class C (255.255.255.0, 254 usable hosts).
  • Each step up in prefix halves the network: /23 = 510, /24 = 254, /25 = 126 hosts.
  • AWS/Azure reserve 5 IPs per subnet, GCP reserves 4 — use cloud mode for accurate counts.
  • Use the reverse mode (IP Range → CIDR) to find the minimum CIDR blocks covering any IP range.

What Is CIDR?

Classless Inter-Domain Routing (CIDR) is an IP addressing scheme that replaced the old classful system (Class A, B, C) in 1993. CIDR uses a variable-length prefix to define network boundaries, written as a slash followed by the number of network bits — for example, 10.0.0.0/16. This flexibility allows ISPs and organizations to allocate exactly the IP address space they need, rather than being forced into fixed class sizes. CIDR also enables route aggregation (supernetting), where multiple contiguous networks are advertised as a single route, dramatically reducing the size of internet routing tables. Without CIDR, the global routing table would be orders of magnitude larger and IPv4 exhaustion would have occurred much earlier.

CIDR Notation Explained

A CIDR block like 192.168.0.0/22 means the first 22 bits are the network prefix and the remaining 10 bits are for host addresses. The total number of addresses is always 2^(32 − prefix). So /22 gives 2^10 = 1,024 addresses (1,022 usable). The subnet mask equivalent is found by setting the first 22 bits to 1: 11111111.11111111.11111100.00000000 = 255.255.252.0. The wildcard mask (used in ACLs and firewall rules) is the bitwise inverse: 0.0.3.255. Every CIDR block has a network address (all host bits zero) and a broadcast address (all host bits one). Usable IPs fall between these two, except for /31 (RFC 3021 point-to-point) and /32 (single host route).

CIDR Planning Considerations

  • CIDR blocks must be naturally aligned — a /22 network must start at a multiple of 1,024 addresses (host bits all zero).
  • Supernetting: two contiguous /24 blocks can be aggregated into one /23, but only if the first block starts at an even boundary.
  • Cloud providers reserve extra IPs: AWS and Azure reserve 5 per subnet (.0, .1, .2, .3, broadcast), GCP reserves 4.
  • When planning VPCs, use non-overlapping CIDR blocks to avoid conflicts with VPN, peering, or hybrid cloud setups.
  • The smallest practical subnet for hosts is /29 (6 usable IPs after reservations) — smaller sizes are for point-to-point links only.
  • Internet registries (ARIN, RIPE, APNIC) require /24 minimum for globally routable BGP announcements.

CIDR Block Sizes for Cloud & Enterprise

  • AWS VPC: supports /16 to /28 (65,534 to 14 IPs). Default VPC is 172.31.0.0/16. Reserves .0 (network), .1 (router), .2 (DNS), .3 (future), broadcast.
  • Azure VNet: supports /8 to /29. Reserves .0 (network), .1 (gateway), .2 (DNS primary), .3 (DNS secondary), broadcast.
  • GCP VPC: supports /8 to /29. Auto-mode subnets use /20 per region. Reserves .0 (network), .1 (gateway), broadcast, DHCP.
  • Docker: default bridge network is 172.17.0.0/16. Custom networks can use any private CIDR. Overlay networks span multiple hosts.
  • Kubernetes: pod CIDR is typically /16, service CIDR is /12 or /16. Each node gets a /24 slice for pods by default.
  • Home routers: most use 192.168.0.0/24 or 192.168.1.0/24. Enterprise routers often use 10.x.x.x/8 for large internal networks.

CIDR Calculation Examples

Step-by-step CIDR conversions

CIDR /22 — Medium Network

  1. Input: 10.10.0.0/22
  2. Prefix bits: 22 → Host bits: 32 − 22 = 10
  3. Total addresses: 2¹⁰ = 1,024
  4. Usable hosts: 1,024 − 2 = 1,022 (standard) | 1,019 (AWS)
  5. Subnet mask: 255.255.252.0
  6. Range: 10.10.0.1 – 10.10.3.254 | Broadcast: 10.10.3.255

10.10.0.0/22 contains 1,022 usable hosts across 4 contiguous /24 blocks.

IP Range → CIDR (Reverse)

  1. Input: Start 192.168.1.0, End 192.168.1.255
  2. Range spans 256 addresses (2⁸)
  3. 256 = 2⁸ → prefix = 32 − 8 = /24
  4. Start address 192.168.1.0 is aligned to /24 boundary
  5. Result: 192.168.1.0/24 (single block covers entire range)
  6. If range was 192.168.1.0 – 192.168.2.127: needs /24 + /25

The reverse calculator finds the minimum set of CIDR blocks to cover any IP range.

Frequently Asked Questions

What does CIDR notation mean?

CIDR notation combines an IP address with a prefix length separated by a slash. For example, 192.168.1.0/24 means the first 24 of 32 bits identify the network, leaving 8 bits (256 addresses) for hosts. The prefix length replaces the older subnet mask notation — /24 equals 255.255.255.0. Larger prefix numbers mean smaller networks: /28 has 16 addresses while /16 has 65,536.

How do I convert a subnet mask to CIDR?

Count the number of consecutive 1-bits in the binary subnet mask. For 255.255.255.0: binary is 11111111.11111111.11111111.00000000 — that's 24 ones, so it's /24. A quick shortcut: subtract the last non-255 octet from 256 and find the power of 2. Example: 255.255.255.240 → 256 − 240 = 16 = 2⁴ → 32 − 4 = /28.

What is the difference between CIDR and VLSM?

CIDR (Classless Inter-Domain Routing) is the addressing system that allows variable-length network prefixes for route aggregation. VLSM (Variable Length Subnet Masking) is the technique of using different-sized subnets within a single network. CIDR is the notation and allocation system used by ISPs; VLSM is the design practice applied within organizations.

Can I combine two CIDR blocks into one?

Yes, this is called supernetting or route aggregation. Two contiguous blocks of the same size can be combined by reducing the prefix by 1. For example, 10.0.0.0/24 and 10.0.1.0/24 become 10.0.0.0/23. The blocks must be contiguous and the first block must be naturally aligned — you cannot aggregate 10.0.1.0/24 and 10.0.2.0/24 into a /23 because 10.0.1.0 is not aligned to a /23 boundary.

How many IPs does each cloud provider reserve?

AWS reserves 5 IPs per subnet: network address (.0), VPC router (.1), DNS server (.2), future use (.3), and broadcast. Azure also reserves 5: network (.0), default gateway (.1), DNS primary (.2), DNS secondary (.3), and broadcast. GCP reserves 4: network (.0), default gateway (.1), second-to-last, and broadcast. So a /24 gives 251 usable IPs on AWS/Azure, 252 on GCP, vs 254 standard.

What is the smallest routable CIDR block on the internet?

Most internet registries (ARIN, RIPE, APNIC) and transit providers accept /24 as the smallest routable prefix. Blocks smaller than /24 are typically filtered by BGP routers and won't propagate globally. Some providers accept /25 in specific peering arrangements, but /24 is the practical minimum for guaranteed global reachability.

Sources