Paste a list of IPv4 or IPv6 CIDR blocks and merge overlapping or adjacent ranges into the smallest possible set of non-overlapping prefixes.
Enter CIDR blocks above to merge overlapping ranges
CIDR aggregation reduces a list of IP prefixes to the smallest equivalent set with no overlaps and no gaps between adjacent blocks. It is used when writing firewall rules, summarising routing tables, or deduplicating IP allowlists.
The algorithm works in three steps. First, each CIDR is converted to a start and end address. Second, overlapping and adjacent ranges are merged into contiguous blocks. Third, each merged block is converted back to the minimal set of CIDR prefixes that cover it exactly.
Adjacent /24s like 10.0.0.0/24 and 10.0.1.0/24 merge to 10.0.0.0/23. Overlapping ranges like 10.0.0.0/8 and 10.0.0.0/24 collapse to 10.0.0.0/8. All arithmetic uses BigInt to avoid 32-bit overflow on addresses like 255.255.255.0.