CIDR Aggregator & IP Range Converter
Merge addresses, CIDR blocks and ranges into the fewest possible blocks, subtract exclusions, and see the first and last address of every block.
One per line (commas and spaces also work). IPv4 and IPv6 can be mixed. Ranges are written first-last, or 192.168.1.10-20 for a last-octet range. Text after # is ignored.
Anything listed here is removed from the result, for example an office range that must stay out of an allow-list.
Aggregated result
Block details
| Block | First address | Last address | Addresses |
|---|
About CIDR aggregation and range conversion
Firewall rules, cloud security groups, allow-lists and route tables all describe address space as CIDR blocks. Lists of those blocks tend to grow untidily: a range copied from a supplier's documentation, a few single addresses added during an incident, two halves of a subnet entered on different days. This tool takes whatever you paste, works out exactly which addresses it covers, and rewrites it as the smallest possible set of CIDR blocks that covers precisely the same addresses, no more and no fewer.
What it accepts
- Single addresses such as
203.0.113.7or2001:db8::1, treated as a /32 or /128. - CIDR blocks such as
198.51.100.0/24or2001:db8::/48. If the address has host bits set, as in192.168.1.77/24, it is treated as the network that contains it (192.168.1.0/24) and a note says so. - Ranges written
first-last, with or without spaces round the hyphen, plus the common IPv4 shorthand192.168.1.10-20for a range within one last octet.
Entries can be separated by new lines, commas, semicolons or spaces, and anything after a # is treated as a comment, so you can paste a commented allow-list straight from a configuration file. IPv4 and IPv6 can be mixed; they are aggregated separately and listed IPv4 first.
How the merging works
Every entry is converted to a numeric interval: a start address and an end address. IPv4 addresses are 32-bit numbers and IPv6 addresses are 128-bit numbers, so the tool uses JavaScript's arbitrary-precision BigInt arithmetic throughout rather than ordinary floating-point numbers, which cannot represent IPv6 exactly. The intervals are sorted, and any that overlap or touch (one ends at x and the next starts at x + 1) are joined into one. Exclusions are then cut out of the merged intervals.
Finally each interval is split into CIDR blocks greedily: starting at the first address, take the largest block that is correctly aligned on that address and does not run past the end of the interval, then repeat from the address after it. This produces the minimum number of blocks for each interval, which is the same result as Python's ipaddress.collapse_addresses and router "summarisation" commands.
Worked examples
→ 192.168.0.0/23 (512 addresses, one block)
The two /25s are halves of 192.168.0.0/24, and that /24 sits directly before 192.168.1.0/24 on an even boundary, so all three collapse into a single /23.
→ 10.0.0.1/32, 10.0.0.2/31, 10.0.0.4/30, 10.0.0.8/29, 10.0.0.16/28,
10.0.0.32/27, 10.0.0.64/26, 10.0.0.128/26, 10.0.0.192/27, … 10.0.0.254/32
A range that does not start and end on block boundaries needs several blocks: fourteen in this case. If your firewall accepts ranges directly, the range is the tidier rule; if it only accepts CIDR, these fourteen are the shortest exact equivalent.
The "Public IPv4 only" example starts with 0.0.0.0/0 (every IPv4 address) and subtracts the three private ranges from RFC 1918. The answer is 31 blocks, which is why "everything except private addresses" is usually written as a deny rule followed by an allow rule instead.
Reading the results
The summary counts how many entries were read and how many blocks came out, with the total number of addresses covered for each family. The table lists every block with its first and last address and its size, which is the reverse conversion from CIDR to range. Use the output format menu to copy the list as CIDR blocks, as merged first-last ranges, or as address and netmask pairs for older IPv4 equipment that does not understand prefix lengths. Short inputs are saved in the address bar, so Copy link shares exactly what you are looking at; inputs over 2,000 characters are left out of the link to keep URLs a sensible length.
Limitations
- Merging is exact. The tool never widens a block to make the list shorter, so it will not invent a /16 to cover two distant /24s. If you want deliberate over-coverage, decide on the wider block yourself.
- IPv4 addresses with leading zeros (such as
010.1.1.1) are rejected, because different software reads them as octal or decimal. Zone indexes such asfe80::1%eth0are rejected too. - IPv4-mapped IPv6 addresses (
::ffff:192.0.2.1) are treated as IPv6, which is what they are; they are not merged with the IPv4 list. - Very large lists are fine, but the details table shows the first 1,000 blocks to keep the page responsive. The copied list always contains everything.
Privacy
Everything happens in your browser. The addresses you paste are not sent to IP Pigeon or anyone else, which matters when the list describes your own network. The only thing that leaves the page is the shareable link, and only if you copy it.
Common questions
What is CIDR aggregation?
CIDR aggregation is the process of combining several adjacent or overlapping IP address blocks into fewer, larger blocks that cover exactly the same addresses. It is also called route summarisation or supernetting. For example, 192.168.0.0/25 and 192.168.0.128/25 aggregate into the single block 192.168.0.0/24, which shortens firewall rules and routing tables without changing what they match.
Can any two adjacent subnets be merged into one CIDR block?
Two adjacent subnets can be merged into one CIDR block only if they are the same size and the first one starts on a boundary of the larger block. 192.168.0.0/24 and 192.168.1.0/24 merge into 192.168.0.0/23, but 192.168.1.0/24 and 192.168.2.0/24 cannot, because no /23 begins at 192.168.1.0.
How do I convert an IP range to CIDR notation?
An IP range is converted to CIDR notation by repeatedly taking the largest block that starts at the first remaining address, is correctly aligned on that address and does not run past the end of the range. A range that falls on block boundaries becomes one block; an awkward one such as 10.0.0.1 to 10.0.0.254 needs fourteen.
What does 0.0.0.0/0 mean?
0.0.0.0/0 means every IPv4 address. A prefix length of zero fixes none of the 32 bits, so the block covers all 4,294,967,296 possible addresses. It is used as the default route in routing tables and to mean any source or destination in firewall rules and cloud security groups. The IPv6 equivalent is ::/0.