Skip to content

6to4 Address Tool

Bidirectional translation between public IPv4 addresses and the 2002::/16 6to4 prefix family defined by RFC 3056.

Deprecated transition mechanism

RFC 7526 (May 2015) formally deprecated the 6to4 anycast relay address 192.88.99.1. Existing 6to4 prefixes still appear in routing tables and address audits, but the mechanism should not be deployed greenfield. This tool is provided for analysis, decoding traffic captures, and migration audits.

How 6to4 works

Every public IPv4 address W.X.Y.Z maps to a unique IPv6 /48 prefix inside 2002::/16 by treating the four V4 octets as two consecutive 16-bit hexadectets:

IPv4:        W.X.Y.Z
6to4 prefix: 2002:WWXX:YYZZ::/48

Inside that prefix, bytes 6–7 hold a 16-bit Subnet/SLA ID and bytes 8–15 hold the standard 64-bit Interface ID:

| 16 bits | 32 bits     | 16 bits   | 64 bits          |
| 2002    | embedded V4 | Subnet ID | Interface ID     |

Decoding inverts the mapping: pull bytes 2–5 to recover the IPv4, bytes 6–7 for the Subnet ID, and bytes 8–15 for the Interface ID.

Encoding (IPv4 → 6to4 prefix)

Public IPv4 6to4 prefix
192.0.2.1 2002:c000:0201::/48
198.51.100.42 2002:c633:642a::/48
203.0.113.5 2002:cb00:7105::/48

The encoder rejects any IPv4 that is not a valid public unicast address:

  • Private (RFC 1918): 10/8, 172.16/12, 192.168/16
  • Link-local: 169.254/16
  • Loopback: 127/8
  • Unspecified: 0.0.0.0
  • Documentation: 192.0.2/24, 198.51.100/24, 203.0.113/24
  • Multicast: 224.0.0.0/4
  • Reserved / future use: 240.0.0.0/4

Decoding (6to4 IPv6 → IPv4 + Subnet ID + IID)

Given 2002:c000:0201:00ab:dead:beef:1234:5678:

Field Value
Embedded IPv4 192.0.2.1
Subnet ID 0x00ab (171)
Interface ID dead:beef:1234:5678

The decoder rejects any address that does not start with 2002. Mapped, compatible, NAT64, Teredo, and ISATAP addresses surface different schemes — use the Embedded IPv4 Detector as the front door when you do not yet know which transition mechanism is in play.

REST API

POST /api/v1/6to4 with one of two request bodies:

{ "mode": "encode", "ipv4": "192.0.2.1" }
{ "mode": "decode", "ipv6": "2002:c000:0201::1" }

Responses include mode plus the converted fields. See REST API → 6to4 and the OpenAPI spec for the complete response schemas and error envelopes.

Shareable URL

Direct-link to a pre-filled conversion:

?tab=ipv6&tool=6to4&sixtofour_mode=encode&sixtofour_input=192.0.2.1

The /ipv6/6to4 per-tool route accepts the same query parameters and auto-opens the drawer with the result rendered.