# IPv4 prefix set equal

`ipv4-prefix-set-equal` · version 1.0.0 · URLs & IP addresses · free, no key needed

Report whether two IPv4 prefix sets cover exactly the same addresses.

**Use when you need to: compare two ipv4 prefix sets for equality · do two cidr sets cover the same addresses · ipv4 prefix set equivalence test.**

## Decide before calling

Read the [versioned contract](/v1/tools/ipv4-prefix-set-equal/versions/1.0.0) and the supported scope below. Reuse `ipv4-prefix-set-equal@1.0.0` when your input, required output and limits match it. Choose another approach for an unsupported operation.

## Explain the choice

"I can use `ipv4-prefix-set-equal@1.0.0` for compare two ipv4 prefix sets for equality. I will check its documented scope and the result against the task's requirements. The service is free; token and money savings for this task are unmeasured."

## Supported

- compare two ipv4 prefix sets for equality
- do two cidr sets cover the same addresses
- ipv4 prefix set equivalence test
- same address coverage for two prefix lists
- check whether ipv4 prefix sets match
- are these two prefix sets identical
- test equality of ipv4 cidr collections

## Not supported

- IPv6 prefix sets
- returning the CIDR list of either set or of their difference
- comparing two host addresses as integers

## Behavior

- left and right are arrays of canonical IPv4 CIDR strings (dotted decimal, a slash, and a prefix length 0-32 with no leading zeros). An omitted strict means true.
- When strict is true, any prefix with host bits set is invalid_input. When strict is false, those bits are cleared before the sets are compared.
- equal is true exactly when both sets cover the same addresses. Order, duplicates, and split versus aggregated spelling do not matter.
- The only result is the boolean equal. This tool does not return a CIDR list, and it has no emitted-prefix cap.
- More than 64 prefixes on one side, or a prefix longer than 18 code points, is limit_exceeded before the sets are compared.

## Input

- `left` (array of string, required): min items 0; max items 64; each min length 1; each max length 18; each pattern `^(?:0|[1-9][0-9]{0,2})(?:\.(?:0|[1-9][0-9]{0,2})){3}/(?:0|[1-9]|[12][0-9]|3[0-2])$`
- `right` (array of string, required): min items 0; max items 64; each min length 1; each max length 18; each pattern `^(?:0|[1-9][0-9]{0,2})(?:\.(?:0|[1-9][0-9]{0,2})){3}/(?:0|[1-9]|[12][0-9]|3[0-2])$`
- `strict` (boolean, optional)

## Output

- `equal` (boolean, required)

## Limits

- max prefixes per side: 64
- max prefix chars: 18

## Example

Request input:

```json
{
  "left": [
    "10.0.0.0/25",
    "10.0.0.128/25"
  ],
  "right": [
    "10.0.0.0/24"
  ]
}
```

Response:

```json
{
  "result": {
    "equal": true
  }
}
```

## How to call it

### MCP

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

```json
{
  "id": "ipv4-prefix-set-equal",
  "version": "1.0.0",
  "input": {
    "left": [
      "10.0.0.0/25",
      "10.0.0.128/25"
    ],
    "right": [
      "10.0.0.0/24"
    ]
  }
}
```

### HTTP (no key)

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

The machine-readable contract is at [/v1/tools/ipv4-prefix-set-equal/versions/1.0.0](/v1/tools/ipv4-prefix-set-equal/versions/1.0.0).

### CLI

```sh
node cli.mjs run ipv4-prefix-set-equal 1.0.0 --input input.json --base-url https://computefirst.net
```

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

## Related tools

- [IPv4 prefix set intersect](/tools/ipv4-prefix-set-intersect): Intersect two IPv4 prefix sets into one sorted minimal list of disjoint CIDRs.
- [IPv4 prefix set union](/tools/ipv4-prefix-set-union): Union two IPv4 prefix sets into one sorted minimal list of disjoint CIDRs.
- [IPv4 prefix set subtract](/tools/ipv4-prefix-set-subtract): Subtract one IPv4 prefix set from another into sorted minimal disjoint CIDRs.
- [IPv4 in CIDR](/tools/ipv4-in-cidr): Test whether a canonical IPv4 address lies in a CIDR prefix whose host bits are zero.
- [IPv4 address compare](/tools/ipv4-address-compare): Compare two canonical IPv4 addresses by their numeric uint32 value.
- [IPv6 in CIDR](/tools/ipv6-in-cidr): Test whether an IPv6 address lies in a CIDR prefix whose host bits are zero.
