Skip to content
gohacks.dev
DevOps

CIDR Merger

Merge a list of IPv4 addresses and CIDR blocks into the fewest blocks: duplicates removed, overlaps and adjacent ranges joined.

Free · No sign-up · Your inputs stay in your browser

Input

Merge and deduplicate CIDR ranges

Output

Aggregated

7 entries became 3, covering 1,049,602 addresses

Overlapping and adjacent blocks are joined and then re-cut into the fewest valid CIDR blocks, so the result covers exactly the same addresses. Useful before pasting a provider's published ranges into a security group, which counts every rule against its limit. IPv4 only.

Runs in this browser. Nothing you paste is sent to a server.

Where long lists come from

Allow lists grow by accretion: office ranges, VPN pools, a CDN's published ranges, partner IPs. Many entries end up contained in others or adjacent to each other. Security groups, WAF rules and Nginx configs all get shorter and easier to audit after aggregation, and cloud providers cap the number of rules per group.

Same coverage, guaranteed

Aggregation never widens a list: two /25s become a /24 only when together they are exactly that /24. Single addresses are treated as /32 blocks.

Share

Frequently asked questions

How do I merge CIDR ranges in Python?
ipaddress.collapse_addresses(list_of_networks) in the standard library does the same aggregation for IPv4 and IPv6.
Can merging open access to addresses that were not listed?
No. The output covers exactly the addresses of the input; blocks are only joined when they are adjacent or overlapping.
Is what I paste sent anywhere?
No. The tool runs entirely in your browser with JavaScript. Nothing you type or paste is sent to our server or stored.

Keep planning

Similar tools