IP range parser
Parse an IPv4/IPv6 range ("start-end" or CIDR) into its address count and the minimal set of CIDR blocks that cover it exactly. Pure arithmetic, no lookup.
Runs on your device. The file is never uploaded.
IP range parser takes a start and end address, or a CIDR block, and reports the exact number of addresses with the CIDR blocks covering them. Blocks are chosen greedily: the largest one aligned to the current address that still fits, then onward from its end. Only the first 256 are listed, though the count stays exact.
Questions
What can I type into it?
Either a start and end pair such as 10.0.0.1-10.0.0.20, or a CIDR block such as 192.168.1.0/24, in IPv4 or IPv6. It prints the range endpoints, the exact address count, and the list of CIDR blocks that cover the range precisely.
How does it choose the CIDR blocks?
Greedily, and exactly. At each step it takes the largest block that is aligned to the current address and still fits inside the range, then continues from the end of it. The result covers your range with no address left out and none added, which is what makes it usable in a firewall or route table.
Why does it say truncated at 256?
Because an awkward range can need thousands of blocks, and printing all of them helps nobody. The total block count is still reported, with a plus sign, and only the first 256 are listed. Align your range to power of two boundaries if you want a shorter list.
What errors can I hit?
Three. Mixing families gives a message naming both endpoints as different address families. A start after the end gives "start address is after end address" with your input. Anything that is neither a range nor a CIDR gives a message asking for "start-end" or "address/prefix".
Is the address count exact for huge ranges?
Yes. The counting and the block splitting both use big integers, so an IPv6 range of astronomical size prints its true count rather than a rounded number in scientific notation. The CIDR list can still be truncated at 256 entries, but the count and the block total above it stay exact.