b2KIT

IP Range Merger & Optimizer

Merge overlapping IP ranges, aggregate CIDR blocks, and minimize firewall rules. Supports allow/deny list optimization.

Tested tool guide Tested browser tools Checked August 16, 2026

What IP Range Merger & Optimizer does, with a checked example

IP Range Merger & Optimizer reduces a collection of IP ranges and CIDR blocks to a smaller representation of the same address coverage. It normalizes the supplied boundaries, removes duplicate or contained coverage, joins compatible intervals, and expresses the result as aggregated CIDR prefixes. Users are often surprised when adjacent blocks merge even though they do not overlap. The larger prefix is valid only when it covers exactly their combined address set. Firewall lists can be sensitive, so processing remains in the browser and nothing is uploaded.

Worked example

A concrete input and expected output from the current implementation.

Input

192.0.2.0/25
192.0.2.128/25

Expected output

192.0.2.0/24

The first /25 covers 192.0.2.0 through 192.0.2.127, and the second covers 192.0.2.128 through 192.0.2.255. Together they form the aligned 256-address block represented exactly by 192.0.2.0/24.

How the result is produced

1

Normalize address coverage

Each CIDR prefix denotes a contiguous, power-of-two-sized address block aligned on a matching boundary. The optimizer compares the actual first and last addresses represented by every entry. Duplicate blocks and blocks wholly contained inside another entry add no new coverage, so they can be removed without changing which addresses the resulting list matches.

2

Merge and aggregate

Overlapping or directly adjacent coverage is treated as a union of addresses. That union is divided into the largest correctly aligned CIDR blocks that do not include any address outside the input coverage. A pair can become one shorter prefix only when its combined size and boundary permit it; otherwise the exact result requires multiple prefixes.

Good uses

  • Condense a vendor allowlist containing duplicate, overlapping, or nested CIDR prefixes before translating it into firewall rules.
  • Combine successive threat-feed exports and remove redundant network coverage before reviewing the resulting deny list.
  • Convert a collection of address ranges into an exact CIDR set suitable for systems that accept prefixes instead of start-end notation.

Limits and checks

  • A shorter output list preserves address coverage, not comments, ownership labels, priorities, or the operational purpose attached to the original entries.
  • Do not optimize allow and deny entries as one undifferentiated set. Identical address coverage can have opposite effects depending on rule action and evaluation order.
  • CIDR coverage includes every address in the prefix. For IPv4, that includes addresses a particular network may label as network or broadcast addresses.

Common questions

Can every start-end IP range become one CIDR block?

No. One CIDR block must contain a power-of-two number of addresses and begin on the corresponding binary boundary. An arbitrary range commonly needs several CIDR prefixes. The optimizer should return multiple prefixes when one larger prefix would include addresses before the stated start or after the stated end.

Does a minimized allow or deny list guarantee the same firewall behavior?

Not by itself. It can preserve the set of addresses represented by each list, but firewall behavior can also depend on rule order, first-match or last-match processing, ports, protocols, interfaces, and exceptions. Optimize address sets with the same action separately, then verify the final policy in the target firewall.

References and verification

The example and behavioral notes were checked against the browser implementation. Standards and primary references below define the relevant format, formula, or platform behavior.

Related Tools