CIDR calculator

Convert CIDR notation to an IP range, or turn any start–end range into the smallest set of CIDR blocks for firewall rules, security groups and allow-lists.

CIDR ↔ range
Block10.20.0.0/14
First IP10.20.0.0
Last IP10.23.255.255
Total addresses262,144
Usable hosts262,142 (10.20.0.1 – 10.23.255.254)
Mask · wildcard255.252.0.0 · 0.3.255.255
/24s inside1,024

Why ranges break into several blocks

A CIDR block always covers a power-of-two number of addresses and must start on a multiple of that size. An arbitrary range rarely lines up, so it's covered by a staircase of blocks: small ones to reach the next boundary, the biggest ones that fit in the middle, then small ones again to finish exactly on the last address. Try 10.0.0.1 to 10.0.0.254: fourteen blocks, because the range just misses both ends of a /24.

Cloud providers publish their own ranges as CIDR lists (AWS's ip-ranges.json, Google's cloud.json, Cloudflare's /ips-v4). For network, broadcast and host range of a single block see the subnet calculator, and for Cisco-style inverse masks the wildcard mask calculator.

Questions people ask

What is CIDR notation?
Classless Inter-Domain Routing writes a network as an address plus the number of fixed leading bits: 10.0.0.0/8 means the first 8 bits are fixed, covering 10.0.0.0 to 10.255.255.255. It replaced classful A/B/C networks in 1993.
How do I convert an IP range to CIDR?
Take the largest block that starts at the range's first address and fits inside it; repeat from the next address. The range tab above does exactly that and returns the minimal list, e.g. 10.0.0.5–10.0.0.20 becomes 10.0.0.5/32, 10.0.0.6/31, 10.0.0.8/29, 10.0.0.16/30, 10.0.0.20/32.
Can a CIDR block start at any address?
No. A /n block must start at a multiple of its size. 10.0.0.8/29 is valid (8 is a multiple of 8); "10.0.0.5/29" is really the block 10.0.0.0/29 with 10.0.0.5 inside it.
How do I merge CIDR blocks?
Two blocks aggregate into one only if they are the same size, adjacent, and the lower one starts on a boundary of the doubled size: 192.168.0.0/24 + 192.168.1.0/24 = 192.168.0.0/23, but 192.168.1.0/24 + 192.168.2.0/24 cannot merge.