BGP Prefix Aggregation Calculator
Summarize IPv4 and IPv6 CIDR routes into the smallest exact prefix set, remove duplicates and contained routes, and compare route count against a single covering prefix.
CIDR prefixes
Ready to aggregate the example prefixes.
Aggregation result
Exact lossless prefixes
| Family | Exact routes | Covered addresses | Single covering prefix | Additional addresses |
|---|
Advertisement
How to use the BGP aggregation calculator
- Paste CIDRs: add IPv4, IPv6, or both. Each entry must include a prefix length.
- Aggregate: invalid entries stop the calculation and are identified; host bits are normalized.
- Use the exact list first: it covers precisely the union of the valid input address space.
- Inspect the covering-prefix warning: a single summary may include gaps that were not present in the input.
- Validate policy: check RPKI, filtering, attributes, reachability, and failure behavior before advertising anything.
CIDR summarization formula and assumptions
A prefix of length p in an address family of b bits contains 2^(b - p) addresses. IPv4 uses 32 bits and IPv6 uses 128 bits.
Exact merge rule: adjacent ranges are converted back to the largest power-of-two blocks that are both aligned and fully covered. Two sibling /p routes therefore become one /(p - 1) only when the complete parent is present.
Single covering prefix: compare the lowest and highest covered addresses. The prefix length is the number of equal leading bits; equivalently, b - bitLength(low XOR high).
Route reduction: (input route count - exact output route count) / input route count × 100%. Duplicate and already-contained input routes count as removable entries.
The tool treats every input prefix as address coverage with equal status. It does not import AS_PATH, origin, MED, communities, local preference, next hop, RPKI ROAs, or router policy, so it cannot decide whether the mathematical aggregate should be announced.
Worked prefix aggregation examples
Four contiguous IPv4 /24 routes
10.20.0.0/24 through 10.20.3.0/24 cover 1,024 aligned addresses. The first two combine to 10.20.0.0/23, the next two combine to 10.20.2.0/23, and those siblings combine to 10.20.0.0/22. Four routes become one with no added address space.
A gap prevents a lossless single route
192.0.2.0/24 and 192.0.4.0/24 remain two exact routes. Their smallest single covering prefix is 192.0.0.0/21, which also covers six other /24-sized blocks. The covering prefix is shorter, but it is not equivalent to the input.
IPv6 aggregation uses the same bit rule
2001:db8:100::/49 and 2001:db8:100:8000::/49 are the two aligned halves of 2001:db8:100::/48, so they can be collapsed exactly.
Standards, limits, and technical review
The address calculations follow the classless prefix model. Operational BGP aggregation has additional path-attribute and policy requirements outside the address math shown here. RFC 9774 now prohibits advertising AS_SET and AS_CONFED_SET path segments by default and specifies consistent brief aggregation; older descriptions of building AS_SETs from contributing routes are no longer current practice.
- RFC 4632: Classless Inter-domain Routing (CIDR) — prefix notation, aggregation, and route-advertisement considerations.
- RFC 4271: A Border Gateway Protocol 4 (BGP-4) — aggregation behavior and the AS_PATH, ATOMIC_AGGREGATE, and AGGREGATOR attributes.
- RFC 9774: Deprecation of AS_SET and AS_CONFED_SET in BGP — current aggregation requirements, consistent brief aggregation, RPKI considerations, and forwarding-loop mitigation.
- RFC 4291: IP Version 6 Addressing Architecture — 128-bit IPv6 addressing and prefix notation.
- RFC 5952: IPv6 Text Representation — recommended compressed output formatting.
Methodology author: Starlight Robotics infrastructure tooling team. Technical review: prefix and BGP behavior checked against the RFCs above. Reviewed: 28 July 2026.
BGP prefix aggregation FAQs
What is BGP prefix aggregation?
BGP prefix aggregation advertises a less-specific route that represents multiple more-specific networks. Exact aggregation reduces route count without adding address space; a broader covering route may also include addresses absent from the input.
When can two CIDR prefixes be combined exactly?
Two same-size sibling prefixes can combine when they are adjacent, aligned on the parent boundary, and together cover that parent completely. The process can repeat with the resulting parent.
What is the difference between an exact summary and a covering prefix?
An exact summary represents only addresses covered by the input. A covering prefix is the single smallest prefix spanning the first through last input address and can include gaps.
Does route aggregation change BGP path attributes?
It can. Production aggregation must account for AS_PATH, ATOMIC_AGGREGATE, AGGREGATOR, communities, next hop, policy, RPKI authorization, and vendor behavior. This calculator evaluates address coverage only.
Can I mix IPv4 and IPv6 prefixes?
Yes. IPv4 and IPv6 are calculated independently because one prefix cannot cover both address families.
Are my prefixes uploaded?
No. Prefix parsing and aggregation run locally in the browser, and the tool does not submit or store the entered prefix list.
Production routing disclaimer
This calculator is a planning aid, not router configuration advice. Before advertising an aggregate, verify ownership and reachability for every covered address, more-specific withdrawal behavior, discard/null routing, prefix filters, maximum-prefix limits, AS_PATH and communities, RPKI ROAs and maxLength, traffic-engineering intent, and vendor-specific configuration.