IP Range to CIDR Calculator
Convert an arbitrary start and end IPv4 address into the minimal list of CIDR blocks that exactly covers the range โ computed instantly and privately in your browser.
Summarise an IP range into CIDR blocks
Firewalls, route tables and access lists usually speak CIDR, not "from this IP to that IP". This IP range to CIDR calculator bridges the gap: give it any start and end IPv4 address and it returns the shortest possible list of CIDR blocks whose union is exactly your range โ no more, no less.
How to use it
- Enter the start IP and end IP (start must be less than or equal to end).
- Press Convert to CIDR to see the aggregated block list and the total address count.
- Use Copy all to paste the whole list straight into a config file.
How the algorithm works
The tool treats each address as an unsigned 32-bit integer. Starting at the low end, it looks at how many trailing zero bits the current address has โ that is the largest block it can align to โ then caps the block so it never spills past the end address. It emits that block, jumps to the next address after it, and repeats. This greedy approach always yields the minimal block set. See what a subnet mask is for the bit-level view.
Ranges that start or end on "odd" boundaries fragment into many blocks. If you control the addressing, aligning ranges to power-of-two boundaries (e.g. start on a .0, .64, .128 or .192) keeps your CIDR lists short and readable.
Going the other way? The CIDR to IP Range converter expands a block back into first and last addresses, and the IPv4 Subnet Calculator gives full details for any single block.
Frequently asked questions
How do I turn an IP range into CIDR blocks?
Enter a start IP and an end IP. The calculator walks the range as 32-bit integers and, at each step, emits the largest CIDR block that starts on the current address and does not overrun the end, until the whole range is covered by the fewest possible blocks.
Why does my range need several CIDR blocks?
A single CIDR block can only represent a power-of-two range that is aligned to its own size. Arbitrary ranges rarely line up perfectly, so they must be split into several correctly aligned blocks โ for example 10.0.0.5 to 10.0.0.20 needs five blocks.
Does the start have to be lower than the end?
Yes. The start address must be less than or equal to the end address. If you swap them the tool shows a friendly error asking you to check the order.
Is my data sent anywhere?
No. The whole calculation happens in your browser with JavaScript. Nothing is uploaded.
Want the theory? Read the guides โ ยท Visit the zoo โ