The problem this solves
Address lists arrive in whatever shape the thing that produced them felt like. A firewall exports prefixes, a ticketing system pastes ranges with a dash, a colleague sends a column from a spreadsheet, and a log gives you addresses buried in lines of text. Somewhere at the end of that there is a rule to write, and the rule wants CIDR blocks — as few of them as possible, because every extra line is another thing to review and another entry in a table that has a size limit.
So this page does three things in order. It finds every address, range and prefix in whatever you paste, ignoring the text around them. It merges everything that overlaps or touches. Then it splits the result back into the smallest set of CIDR blocks that covers exactly the same addresses — no more and, importantly, no fewer.
What it recognises
- Single addresses:
192.0.2.7,2001:db8::1 - Prefixes:
10.0.0.0/8,2001:db8::/48 - Ranges with a dash:
10.0.1.0 - 10.0.1.255 - Any of the above surrounded by other text — log lines, JSON,
iptables -Loutput, a wall of HTML. The rest of the line is simply skipped.
IPv4 and IPv6 are handled together and reported separately, because merging across families is meaningless: they are different address spaces that happen to be written on the same page.
A prefix is normalised to its own boundary before anything else happens. If you paste
192.168.1.50/26 — an address inside a block rather than the block itself — it is read
as 192.168.1.0/26, which is the network that address actually belongs to and almost
certainly what was meant.
Why "merge" includes blocks that merely touch
Overlapping blocks obviously collapse into one. Less obviously, so do adjacent ones:
10.0.0.0/25 and 10.0.0.128/25 are two halves of exactly
10.0.0.0/24, and returning them as two lines when one line says the same thing would be
a worse answer, not a more faithful one. The merge therefore joins ranges when the next one starts
at most one address after the previous one ends.
This is the step that does the real work on real input. Firewall exports and abuse feeds are full of blocks that were added at different times by different people and which, taken together, are simply a larger block.
What "smallest set" means, and why it is exact
Turning an arbitrary range into CIDR blocks is not a matter of taste. Given a range, there is exactly one minimal set of prefixes that covers it precisely, and the way to find it is mechanical: from the current start, take the largest block that is both aligned to that start and small enough to fit inside what remains, emit it, move the start past it, repeat.
Alignment is the part that surprises people. A /24 can only begin at a multiple of
256, so the range 10.0.0.5 - 10.0.1.20 does not become one or two round blocks — it
becomes a staircase of small prefixes at the start, a large one in the middle and another
staircase at the end. That is not the tool being unhelpful; that is what the range is. If the
staircase is unwelcome, the fix is to choose range boundaries that fall on power-of-two
boundaries.
How it stays fast on large input
The obvious implementation — expand every range into a list of addresses, sort them, remove
duplicates, group them again — works beautifully on twenty addresses and freezes the tab on
10.0.0.0/8, which is sixteen million of them. A single /16 of IPv6 would
be worse than any computer will ever handle.
Nothing here ever enumerates addresses. Every input becomes an interval — a pair of very large
integers — and the merging and splitting operate on intervals. The cost depends on how many
entries you paste, not on how many addresses they describe, which is why
0.0.0.0/0 and a single host cost the same.
Two ceilings still exist to protect the tab: a limit on how many entries are read from the text and a limit on how many prefixes are printed. If either is reached the page says so, with the numbers, instead of quietly returning a shorter answer. A truncated list that looks complete is the one genuinely dangerous failure mode for a tool like this — you would take it away and build a rule with a hole in it.
This is the page we most want to run in your browser
Of everything on this site, this is the tool people paste the most sensitive material into: raw log lines, firewall configuration, internal address plans. That material describes the inside of a network, and it should not leave the machine it is on merely because someone wanted to tidy up a list.
So there is no form here that submits, no request in the background, and no record of anything you paste — the entire operation is JavaScript in your tab. Load the page, disconnect the network, and it keeps working; that is the simplest way to confirm the claim without taking our word for it.