# IPv4 CIDR aggregate

`ipv4-cidr-aggregate` · version 1.0.0 · URLs & IP addresses · free, no key needed

Merge a list of IPv4 CIDR blocks into the minimal equivalent list of non-overlapping CIDR blocks.

**Use when you need to: ipv4 cidr aggregate · summarize ipv4 cidr list · collapse ipv4 subnets.**

## Supported

- ipv4 cidr aggregate
- summarize ipv4 cidr list
- collapse ipv4 subnets
- ipv4 cidr supernet merge

## Not supported

- IPv6
- preserving input order or duplicate entries

## Behavior

- cidrs is a non-empty array of at most 512 dotted-decimal/prefix strings, each with host bits zero.
- Overlapping and directly adjacent blocks are merged; a block fully covered by another is absorbed into it.
- aggregated is the minimal ordered (ascending network address) list of CIDR blocks whose union equals the union of the input blocks.
- Throws if the result would exceed 4096 blocks.

## Input

- `cidrs` (array of string, required): min items 1; max items 512; each max length 18

## Output

- `aggregated` (array of string, required): max items 4096; each max length 18
- `count` (integer, required): min 1; max 4096

## Limits

- max cidr length: 18
- max input cidrs: 512
- max output blocks: 4096

## Example

Request input:

```json
{
  "cidrs": [
    "10.0.0.0/25",
    "10.0.0.128/25",
    "10.0.2.0/24"
  ]
}
```

Response:

```json
{
  "result": {
    "aggregated": [
      "10.0.0.0/24",
      "10.0.2.0/24"
    ],
    "count": 2
  }
}
```

## How to call it

### MCP

Connect `https://computefirst.net/mcp` ([setup](/docs#connect)), then call `execute` with:

```json
{
  "id": "ipv4-cidr-aggregate",
  "version": "1.0.0",
  "input": {
    "cidrs": [
      "10.0.0.0/25",
      "10.0.0.128/25",
      "10.0.2.0/24"
    ]
  }
}
```

### HTTP (no key)

```sh
curl -X POST https://computefirst.net/v1/tools/ipv4-cidr-aggregate/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"cidrs":["10.0.0.0/25","10.0.0.128/25","10.0.2.0/24"]}'
```

The machine-readable contract is at [/v1/tools/ipv4-cidr-aggregate/versions/1.0.0](/v1/tools/ipv4-cidr-aggregate/versions/1.0.0).

### CLI

```sh
node cli.mjs run ipv4-cidr-aggregate 1.0.0 --input input.json --base-url https://computefirst.net
```

Get the client at [/clients/cli/](/clients/cli/).

## Related tools

- [IPv6 CIDR aggregate](/tools/ipv6-cidr-aggregate): Merge a list of IPv6 CIDR blocks into the minimal equivalent list of non-overlapping CIDR blocks.
- [IPv4 CIDR subnets](/tools/ipv4-cidr-subnets): Split an IPv4 CIDR block into the full ordered list of equal-size subnets at a given longer prefix.
- [IPv4 range to cidrs](/tools/ipv4-range-to-cidrs): Convert an arbitrary IPv4 address range into the minimal list of CIDR blocks that exactly covers it.
- [IPv4 CIDR contains](/tools/ipv4-cidr-contains): Test whether one IPv4 CIDR block fully contains another IPv4 CIDR block.
- [IPv4 CIDR overlap](/tools/ipv4-cidr-overlap): Test whether two IPv4 CIDR blocks overlap (share at least one address).
- [IPv4 CIDR parse](/tools/ipv4-cidr-parse): Parse an IPv4 CIDR block into its network, broadcast, netmask, wildcard mask, usable host range and address counts.
