# IPv6 in CIDR

`ipv6-in-cidr` · version 1.0.0 · URLs & IP addresses · free, no key needed

Test whether an IPv6 address lies in a CIDR prefix whose host bits are zero.

**Use when you need to: ipv6 in cidr · check ipv6 cidr membership · ipv6 address in network prefix.**

## Supported

- ipv6 in cidr
- check ipv6 cidr membership
- ipv6 address in network prefix

## Not supported

- IPv4
- zone/scope IDs

## Behavior

- address accepts any RFC 4291 textual form (see ipv6-parse).
- cidr is address/prefix with prefix a canonical decimal integer 0-128 and no leading zeros except 0.
- The CIDR network address must have host bits zero; otherwise the tool throws "cidr host bits must be zero".
- inside is true iff address's 128-bit value is in [network, network + 2^(128-prefix) - 1].
- network is the RFC 5952 canonical network address; prefix is a JSON integer.

## Input

- `address` (string, required): max length 45
- `cidr` (string, required): max length 49

## Output

- `inside` (boolean, required)
- `network` (string, required): max length 45
- `prefix` (integer, required): min 0; max 128

## Limits

- max address length: 45
- max cidr length: 49
- prefix min: 0
- prefix max: 128

## Example

Request input:

```json
{
  "address": "2001:db8::10",
  "cidr": "2001:db8::/32"
}
```

Response:

```json
{
  "result": {
    "inside": true,
    "network": "2001:db8::",
    "prefix": 32
  }
}
```

## How to call it

### MCP

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

```json
{
  "id": "ipv6-in-cidr",
  "version": "1.0.0",
  "input": {
    "address": "2001:db8::10",
    "cidr": "2001:db8::/32"
  }
}
```

### HTTP (no key)

```sh
curl -X POST https://computefirst.net/v1/tools/ipv6-in-cidr/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"address":"2001:db8::10","cidr":"2001:db8::/32"}'
```

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

### CLI

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

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

## Related tools

- [IPv4 in CIDR](/tools/ipv4-in-cidr): Test whether a canonical IPv4 address lies in a CIDR prefix whose host bits are zero.
- [IPv6 CIDR contains](/tools/ipv6-cidr-contains): Test whether one IPv6 CIDR block fully contains another IPv6 CIDR block.
- [IPv6 CIDR overlap](/tools/ipv6-cidr-overlap): Test whether two IPv6 CIDR blocks overlap (share at least one address).
- [IPv6 CIDR parse](/tools/ipv6-cidr-parse): Parse an IPv6 CIDR block into its canonical network address, prefix, first/last address, and total address count.
- [IPv6 range to cidrs](/tools/ipv6-range-to-cidrs): Convert an arbitrary IPv6 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.
