Skip to content

CIDR Range Calculator

Turn an arbitrary start–end IP range into the smallest exact set of CIDR blocks, or expand CIDR blocks into their first and last address.

Processed locally in your browser

Options
0 chars · 0 lines
The result will appear here.

What is CIDR Range Calculator?

Firewalls, security groups and route tables speak CIDR, but address ranges often arrive as "start - end". A range only maps to a single CIDR block when it is aligned to a power of two; otherwise it must be covered by several blocks. This tool finds the minimal set that covers exactly the range, with no address inside or outside it left over.

Choose the direction: range → CIDR (one range per line, separated by a hyphen or "to") or CIDR → range (one block per line). IPv4 and IPv6 are handled with exact BigInt arithmetic and a per-line summary is shown for multi-line input.

How does it work?

  1. Select "IP range → CIDR blocks" or "CIDR → first / last IP".
  2. Enter one range or block per line, such as 10.0.0.5 - 10.0.1.20 or 172.16.0.0/12.
  3. Copy the resulting list; single-line input also shows total addresses and the number of blocks.
  4. Lines that cannot be parsed are reported individually without stopping the others.

Common use cases

  • Converting a provider’s "first - last" allocation into rules for an allow-list.
  • Summarizing a contiguous set of addresses to keep a routing table or ACL short.
  • Finding the exact first and last address covered by a CIDR block in a firewall rule.
  • Checking how many blocks an awkward range like .5 to .20 really needs.

Examples

Try this input in the tool above:

Input
10.0.0.5 - 10.0.1.20
Output
10.0.0.5/32
10.0.0.6/31
10.0.0.8/29
10.0.0.16/28
10.0.0.32/27
10.0.0.64/26
10.0.0.128/25
10.0.1.0/28
10.0.1.16/30
10.0.1.20/32

Privacy

CIDR Range Calculator runs entirely in your browser. The text or files you provide are processed on your device and are not uploaded, logged or stored on our servers.

Limitations

The result is exact and minimal for the given range, but it does not merge separate input lines together. Ranges must use the same address family on both ends.

Frequently asked questions

Why is 10.0.0.5 - 10.0.1.20 more than one block?

Because it does not start and end on a power-of-two boundary. The minimal cover is 10.0.0.5/32, 10.0.0.6/31, 10.0.0.8/29, 10.0.0.16/28, 10.0.0.32/27, 10.0.0.64/26, 10.0.0.128/25, 10.0.1.0/28 and smaller pieces up to .20.

Can I supply a CIDR with host bits set?

Yes. In CIDR → range mode the block is normalised to its network address first, so 192.168.1.77/24 yields 192.168.1.0 - 192.168.1.255.

Does it work for IPv6?

Yes. Both directions support IPv6, and total address counts are exact big integers.

More tools in Network Tools →