CIDR Range Merger

A firewall, ACL or load-balancer config often carries dozens of CIDR entries that overlap, contain each other or sit side by side on a clean boundary. Paste your list below and this tool collapses it into the smallest possible set of CIDR blocks - for IPv4, IPv6, or both at once - without changing which addresses are covered.

Private by design. This is a pure in-browser tool: your network list never leaves this page. Nothing is uploaded, stored or sent to a server, so it is safe to paste production ranges, internal RFC 1918 space or customer allocations.

1. Paste your networks

One network per line (commas also work). Accepted forms: CIDR such as 192.168.1.0/24, a dotted mask such as 10.0.0.0/255.0.0.0, or a bare address, which is treated as /32 (IPv4) or /128 (IPv6). Lines starting with # or ; are ignored.

The result updates as you type. Mixed input is merged separately per family; force a single family to flag the other one as an error.

2. Input check

3. Merged result

Paste networks above to see the merged result.

What the CIDR Range Merger does

Supernetting - combining several CIDR blocks into fewer, larger ones - is one of the most common ways to keep routing tables, firewall rules and access lists manageable. The problem with doing it by hand is that the answer is only right when every pair of merged blocks lines up exactly on a power-of-two boundary, and one misaligned block silently changes which addresses your rule covers. This tool removes that risk: you paste the networks you already have, and it returns the mathematically smallest set of CIDR blocks whose union is identical to your input - no address gained, no address lost.

It works for IPv4 and IPv6 in the same pass. If your list mixes both families, which happens more often than you would think once a /64 or two leaks into an ACL export, the tool splits the input automatically and gives you one minimal result per family instead of rejecting the whole list.

How the merge works

Each entry is first parsed into three things: its family (32-bit or 128-bit), its network address, and its prefix length. A bare IP becomes a /32 or /128; a dotted mask such as 255.255.255.0 is converted to /24 after a contiguity check, so a typo like 255.0.255.0 is flagged instead of silently misinterpreted. If an entry has host bits set - say 192.168.1.5/24 - it is normalised to its network address (192.168.1.0/24) and a warning tells you how many entries needed that.

The merge itself is the classic linear supernetting algorithm. Blocks are sorted by start address, then walked in order with a stack. When the next block is fully inside the previous one it is dropped - that is an absorbed duplicate. When two blocks are the same size, sit side by side, and the earlier one starts on the boundary of the combined size, they collapse into one parent block, and that parent is immediately checked against whatever is below it on the stack, so chains like four /24s rolling up into a single /22 all happen in one pass. Because every merge only ever combines aligned siblings, the output is guaranteed to be the exact, minimal cover of your input - there is no over-approximation and no way for the tool to "helpfully" widen a range.

How to use it

  1. Paste your networks into the box, one per line. Exports from ip route show, firewalld rules, cloud security-group lists and DNS zone files all work after a quick cleanup.
  2. Check the input report: every unparseable entry is listed with its line number, and host-bit normalisations are counted so you know what was adjusted.
  3. Read the merged table. Each output block shows its start and end address, prefix length, total address count and usable host count, which makes it easy to sanity-check that nothing surprising happened.
  4. Use the sort control when you need the result in a particular order - by network address for routing tables, or by prefix size when you want the broadest blocks first for rule placement.
  5. Copy the merged list as plain text, or download it as CSV or JSON for a ticket, a change record or a script.

A worked example

Suppose your firewall carries these four IPv4 entries:

192.168.10.0/24
192.168.11.0/24
192.168.12.0/24
192.168.13.0/25

The first two blocks are the same size, sit next to each other, and 192.168.10.0 starts exactly on a /23 boundary (the second octet group is even), so they merge into 192.168.10.0/23. The remaining pair cannot merge: 192.168.12.0/24 and 192.168.13.0/25 are different sizes, and there is no single CIDR block that covers exactly those two ranges without also including addresses you did not ask for. The result is three blocks - 192.168.10.0/23, 192.168.12.0/24 and 192.168.13.0/25 - covering the same 3,840 addresses as the original four.

The same logic at IPv6 scale: the four /48s 2001:db8:0::/48 through 2001:db8:3::/48 roll up in two stages - each even/odd pair collapses into a /47, and those two /47s are themselves aligned siblings, so the whole set becomes a single 2001:db8::/46. Load the built-in IPv6 example to watch it happen.

Common mistakes this tool catches

  • Merging non-aligned blocks by eye. Two /24s only roll into a /23 when the first starts on an even boundary. The algorithm enforces this, so you never end up with a supernet that covers addresses outside your intent.
  • Duplicate and contained ranges. An ACL that lists both 10.0.0.0/8 and 10.0.5.0/24 carries dead weight; the merger absorbs the smaller block and tells you how many were absorbed so you can find and remove the originals.
  • Host bits left in an input. Pasting 192.168.1.5/24 from a host route is a classic copy-paste slip; the tool normalises it and warns rather than producing a /32 out of nothing.
  • Mixed families in one rule set. Treating an IPv6 address as IPv4 (or pasting both into a v4-only field) is a frequent source of silent drop rules; the auto-detect mode separates them cleanly.
  • Non-contiguous masks. A mask like 255.0.255.0 is not a valid subnet mask; the dotted-mask parser rejects it with a line number instead of guessing a prefix length.

Privacy

Everything on this page runs in your browser. The list you paste is parsed, merged and rendered by local JavaScript - there is no upload, no server-side processing, no analytics event carrying your data, and the page keeps working even after your connection drops. For that reason it is safe to use with ranges you would not paste into a public web form: internal allocations, customer IP space, or anything from a production firewall export.

Related tools


Luke Keam
Spot a bug or want a custom utility built? I'd love to hear from you. Get in touch
Luke Keam | techgeek.biz