Skip to content

Range ↔ CIDR

IP range calculator.

Enter a first and last IPv4 address to get the exact set of CIDR blocks that covers it — the format firewalls, cloud security groups and allow-lists expect.

Enter the first and last IPv4 address of the range

191 addresses → 8 CIDR blocks

  • 192.168.1.10/312 IPs · 255.255.255.254
  • 192.168.1.12/304 IPs · 255.255.255.252
  • 192.168.1.16/2816 IPs · 255.255.255.240
  • 192.168.1.32/2732 IPs · 255.255.255.224
  • 192.168.1.64/2664 IPs · 255.255.255.192
  • 192.168.1.128/2664 IPs · 255.255.255.192
  • 192.168.1.192/298 IPs · 255.255.255.248
  • 192.168.1.200/321 IPs · 255.255.255.255

IP range to CIDR

Many systems accept ranges only as CIDR blocks: firewall rules, AWS security groups, Cloudflare and nginx allow-lists, BGP prefix lists. If you have a start and end address, such as 192.168.1.10 to 192.168.1.200, this IP range calculator finds the smallest list of CIDR blocks that covers the range exactly, so you do not accidentally allow neighbouring addresses.

How the conversion works

  1. Start at the first address.
  2. Take the largest block that is aligned on that address (its size divides the address) and still fits before the end of the range.
  3. Emit that block, move to the address just after it and repeat until the end is reached.

Because every block must be aligned on a multiple of its own size, ranges that begin or end at awkward addresses need several blocks. A range that is exactly one subnet, such as 10.0.0.0 – 10.0.255.255, collapses to a single 10.0.0.0/16.

CIDR to IP range

To go the other way, use the CIDR calculator or the IP subnet calculator. The range of a CIDR block runs from its network address to its broadcast address. For 172.16.0.0/20 that is 172.16.0.0 to 172.16.15.255, 4,096 addresses.

Merging several ranges

Adjacent or overlapping networks can be combined into a single larger prefix (route summarisation). Two neighbouring /24 networks that start on an even boundary — for example 10.0.0.0/24 and 10.0.1.0/24 — collapse into 10.0.0.0/23. Summarising keeps routing tables and firewall rule sets short.

Frequently asked questions

How do I convert an IP range to CIDR?

Enter the first and last IP address. The calculator splits the range into the smallest set of aligned CIDR blocks that covers it exactly — no more, no less. A range that is not a perfect power-of-two block usually needs several CIDR blocks.

How do I find the IP range of a CIDR block?

The first address is the network address and the last is the broadcast address. Use the CIDR calculator or the main IP subnet calculator: 10.0.0.0/22 spans 10.0.0.0 to 10.0.3.255.

Why does my range need multiple CIDR blocks?

A CIDR block must start on a boundary that is a multiple of its size and have a power-of-two length. 192.168.1.10–192.168.1.200 does not fit one block, so it is covered by eight blocks.

How many IP addresses are in a range?

Subtract the first address (as an integer) from the last and add one. The calculator shows the total for you.