IPv4/IPv6 Converter

Convert IPv4 to IPv4-mapped, IPv4-compatible and 6to4 IPv6, and normalise IPv6 notation.

  • Runs locally in your browser
  • No upload required

Try it

IPv4
192.0.2.1
IPv4-mapped IPv6
::ffff:192.0.2.1
IPv4-compatible IPv6
::192.0.2.1
6to4 IPv6
2002:c000:201::
Mapped (compressed)
::ffff:c000:201
Compatible (compressed)
::c000:201
Decimal
3221225985
IPv4: 192.0.2.1
IPv4-mapped IPv6: ::ffff:192.0.2.1
IPv4-compatible IPv6: ::192.0.2.1
6to4 IPv6: 2002:c000:201::
Mapped (compressed): ::ffff:c000:201
Compatible (compressed): ::c000:201
Decimal: 3221225985

Supported formats

Input
text
Output
text, number

Privacy

Runs entirely in your browser. Your input is never uploaded, stored, or sent to a third party.

Processing
In your browser
Privacy level
Browser only

IPv4 192.0.2.1 → ::ffff:192.0.2.1.

How it works

  • Parsed the 32-bit IPv4 address.
  • Prepended the 0xffff marker for the IPv4-mapped form and the all-zero prefix for the compatible form.
  • Placed the address in the 6to4 prefix 2002::/16.
  • IPv4-compatible addresses are deprecated but still recognised.
  • A general IPv6 address is never coerced into an IPv4 address.

Methodology

  1. Detect the address family with strict parsers (dotted-quad first, then IPv6).
  2. For IPv4, place the 32-bit value in the mapped, compatible and 6to4 prefixes.
  3. For IPv6, split into eight groups, compress the longest zero run, expand, and serialise the 128-bit value as a big integer.
  4. Refuse to coerce a general IPv6 address into IPv4.

Usage

  1. Choose a conversion mode (or leave it on Auto).
  2. Enter an IPv4 or IPv6 address.
  3. Read or copy the converted forms.

Examples

These are examples, not current values: they use fixed inputs, while the interactive tool computes live results in your browser.

IPv4 to its IPv6 forms

jsonSelect to copy
{
  "address": "192.0.2.1",
  "mode": "ipv4-to-ipv6"
}

Normalise a compressed IPv6

jsonSelect to copy
{
  "address": "2001:db8::1",
  "mode": "ipv6-normalize"
}

Recover IPv4 from an IPv4-mapped address

jsonSelect to copy
{
  "address": "::ffff:192.0.2.1",
  "mode": "ipv6-to-ipv4"
}

Limitations

Three ways to embed IPv4

IPv6 has several address forms that carry an IPv4 address in their low 32 bits. The IPv4-mapped form (::ffff:0:0/96) represents an IPv4 node on a dual-stack host, 6to4 (2002::/16) encodes an IPv4 address as the tunnel endpoint, and the deprecated IPv4-compatible form (::/96) was an early transition mechanism.

Text compression is separate from the address itself: :: may replace the longest run of zero groups once, and the converter always round-trips the address through its 128-bit integer value so the notation and the value never disagree.

Frequently asked questions

What is an IPv4-mapped IPv6 address?
It has the form ::ffff:a.b.c.d and is used on dual-stack hosts to represent an IPv4 node with an IPv6 address. The tool converts it back to dotted IPv4 exactly.
Does every IPv6 address contain an IPv4 address?
No. Only mapped, compatible and 6to4 addresses embed an IPv4 address; the converter says so rather than inventing one.

Sources

  1. RFC 4291: IP Version 6 Addressing Architecture — IETF
  2. RFC 3056: Connection of IPv6 Domains via IPv4 Clouds — IETF