IP Range to CIDR
Turn a start–end IP range into the smallest exact set of CIDR blocks (IPv4 or IPv6)
Frequently Asked Questions
What does an IP range to CIDR converter do?
It takes an arbitrary start and end IP address and returns the smallest set of CIDR blocks (network/prefix pairs like 192.168.1.0/24) that covers exactly that range — no more and no fewer addresses. This is the reverse of a CIDR calculator, which expands a single CIDR block into its address range. It is commonly needed for firewall rules, route tables, ACLs, and allow/deny lists that accept CIDR notation but not raw ranges.
Why does one IP range produce several CIDR blocks?
A single CIDR block can only describe a range whose size is a power of two and whose start is aligned to that size. An arbitrary range — for example 192.168.1.5 to 192.168.1.20 — usually is not power-of-two sized or aligned, so it must be split into several aligned power-of-two blocks. The converter always returns the minimal set: the fewest CIDR blocks that cover the range exactly.
Does this work for IPv6 ranges?
Yes. The tool detects whether both addresses are IPv4 or IPv6 and runs the same aggregation algorithm using big-integer math, so an IPv6 range such as 2001:db8:: to 2001:db8::ff is reduced to its minimal CIDR set just like an IPv4 range. Both addresses must be the same family.