CIDR aggregator
Paste a list of addresses, ranges and blocks and get the fewest CIDR blocks that cover exactly the same addresses.
More in IP and subnets
What the aggregator does
Firewall allow-lists, block-lists and route tables grow by copy and paste. Over a few years one list ends up with duplicates, a /24 next to the /25 that is already inside it, single addresses that could be one block, and ranges nobody wrote in CIDR form. This tool reads the whole mess and gives back the smallest set of CIDR blocks that covers the same addresses.
It reads one entry per line in any mix of notations: a single address such as 203.0.113.10, a block such as 10.0.0.0/24, a range such as 10.0.3.0-10.0.3.255, an address with a netmask such as 198.51.100.0 255.255.255.0, and IPv6 such as 2001:db8::/33. Text that was defanged for safe sharing, like 10[.]0[.]0[.]1, is read as the plain address.
Next to each result block you see how many entries fed it, and next to each entry you see the block it ended up in, so you can check the merge instead of trusting it.
Exact merge never adds addresses
In exact mode the result covers the same addresses as your list, no more and no fewer. Overlapping and touching entries join, and a block is only ever replaced by blocks that hold exactly its addresses. That matters for a firewall: a merge that quietly lets in addresses you never listed is a security change, not a tidy-up.
| You paste | Exact result | Why |
|---|---|---|
10.0.0.0/25 and 10.0.0.128/25 | 10.0.0.0/24 | Two siblings join into their parent |
10.0.0.0/24 and 10.0.0.77 | 10.0.0.0/24 | The single address is already inside |
10.0.1.0/24 and 10.0.2.0/24 | Both stay | They touch, but no single block holds exactly them |
203.0.113.10 to 203.0.113.13 | 203.0.113.10/31, 203.0.113.12/31 | Four addresses that do not line up on a /30 boundary |
Exclusions and cover mode
The exclusion box removes ranges from the result. Allow 10.0.0.0/22 except 10.0.1.128/25 and you get 10.0.0.0/24, 10.0.1.0/25 and 10.0.2.0/23: the hole is cut out and the rest is written as the fewest blocks.
Cover mode is for when a short list matters more than precision. You choose the most blocks you can live with, and the tool joins the neighbours that add the fewest extra addresses until it is within your limit. It then says exactly how many addresses the list covers that you did not list. It never joins blocks across an address you excluded, and it treats IPv4 and IPv6 separately.
Read the extra-address count before you paste a cover result into a firewall. Four extra addresses in a /29 may be fine. Four million may not be.
Ready for your platform
Under More options, pick the format of the export: a plain list, nginx allow lines, ipset and iptables commands, an nftables set, an AWS WAF IP set as JSON, a Cloudflare list, a Terraform list or CSV. The export holds only the merged blocks, written the way that platform expects them. Check the limits of your own platform before you load a long list, because they differ by product and plan.
Where your list goes
With JavaScript on, the list is merged in your browser and nothing you paste is sent to us. Without JavaScript, the form sends the list to our server in the page address, which limits how long a list can be, and the server merges it. The API and the no-JavaScript form take about 4,000 lines (a 64 KB request). The browser takes up to 100,000. Our privacy policy has the details.
Questions people ask
What is CIDR aggregation?
It is replacing a list of addresses and blocks with fewer blocks that cover the same addresses. It is also called route summarisation or supernetting when it is done for routing. The aim is a shorter list that is easier to read, cheaper to load and faster to match.
Why did two neighbouring blocks not merge?
Two blocks only join when they are siblings: the same size, next to each other, and together exactly one larger block. 10.0.1.0/24 and 10.0.2.0/24 are neighbours, but the /23 around the first one starts at 10.0.0.0, so joining them would add 10.0.0.0/24.
What is the difference between exact and cover mode?
Exact mode gives the smallest list that covers precisely your addresses. Cover mode gives at most the number of blocks you choose and may include addresses you did not list. It always tells you how many.
Can I mix IPv4 and IPv6 in one list?
Yes. The two families are merged separately and the result lists IPv4 first. The counts show each family on its own.
What happens to lines that are not addresses?
They are skipped, and the page lists each one with its line number and the reason, so you can fix it and merge again. The rest of the list is still merged.
Is there a limit on the list?
The browser merges up to 100,000 lines. REST and MCP calls take about 4,000 lines and answer with at most 5,000 blocks. Over the limit, split the list, merge each part and then merge the results again.
Use it from AI, the API or the command line
Every LookupOwl tool is also a free API and an MCP tool, with no key and no account. This one is cidr_aggregate. Please be kind to the rate limits.
curl "https://lookupowl.com/api/v1/tools/cidr-aggregate?q=10.0.0.0%2F24%0A10.0.1.0%2F24%0A10.0.2.0%2F25%0A10.0.2.128%2F25%0A10.0.3.7%0A10.0.3.0-10.0.3.255%0A192.168.1.0%2F24%0A192.168.1.64%2F26%0A203.0.113.10%0A203.0.113.11%0A203.0.113.12%0A203.0.113.13%0A2001%3Adb8%3A%3A%2F33%0A2001%3Adb8%3A8000%3A%3A%2F33%0A198.51.100.0+255.255.255.0"claude mcp add --transport http lookupowl https://lookupowl.com/mcp