# IPv6 format

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

Format 8 hextets or a 128-bit integer string as the RFC 5952 canonical compressed IPv6 address.

**Use when you need to: ipv6 format · format ipv6 canonical · hextets or integer to ipv6.**

## Supported

- ipv6 format
- format ipv6 canonical
- hextets or integer to ipv6

## Not supported

- IPv4-embedded output form
- zone/scope IDs

## Behavior

- Input is exactly one of hextets or integer; unknown fields, both, or neither throw.
- hextets is an array of exactly 8 JSON integers 0-65535.
- integer is a canonical decimal string n with 0 <= n <= 340282366920938463463374607431768211455.
- address is the RFC 5952 canonical form: lowercase hex, no leading zeros per group, and the leftmost longest run of two or more all-zero groups compressed once as "::" (no run under length 2 is compressed).
- ipv6-format(ipv6-parse(a)) yields the canonical form of a for every valid IPv6 address a.

## Input

- object

## Output

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

## Limits

- integer max: 340282366920938463463374607431768211455
- hextet count: 8

## Example

Request input:

```json
{
  "hextets": [
    8193,
    3512,
    0,
    0,
    0,
    0,
    0,
    1
  ]
}
```

Response:

```json
{
  "result": {
    "address": "2001:db8::1"
  }
}
```

## How to call it

### MCP

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

```json
{
  "id": "ipv6-format",
  "version": "1.0.0",
  "input": {
    "hextets": [
      8193,
      3512,
      0,
      0,
      0,
      0,
      0,
      1
    ]
  }
}
```

### HTTP (no key)

```sh
curl -X POST https://computefirst.net/v1/tools/ipv6-format/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"hextets":[8193,3512,0,0,0,0,0,1]}'
```

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

### CLI

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

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

## Related tools

- [IPv6 parse](/tools/ipv6-parse): Parse an IPv6 address (any RFC 4291 textual form) into its 8 hextets and a 128-bit integer string.
- [IPv4 format](/tools/ipv4-format): Format a uint32 integer string or four octets as a canonical dotted-decimal IPv4 address.
- [IPv6 address offset](/tools/ipv6-address-offset): Add a signed integer offset to an IPv6 address, throwing if the result leaves the IPv6 address space.
- [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 IPv4 mapped](/tools/ipv6-ipv4-mapped): Convert between an IPv4 address and its IPv4-mapped IPv6 form (::ffff:0:0/96), in either direction.
- [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.
