OneWebDesk

IPv4 ↔ IPv6 Mapping

Convert an IPv4 address to IPv4-mapped/compatible IPv6 forms and back.

There are several ways to represent an IPv4 address inside IPv6. This tool converts a single IPv4 address into the common IPv4-mapped form (::ffff:192.0.2.33), its hex equivalent (::ffff:c000:0221), the deprecated IPv4-compatible form, and the matching 6to4 prefix — all at once. Paste a mapped IPv6 string back in and it restores the original dotted IPv4 address.

In dual-stack server logs and socket debugging you constantly run into addresses starting with ::ffff:, and this tool tells you what they really are. To normalize the IPv6 notation itself use the IPv6 Compress / Expand, and for subnet math reach for the CIDR Calculator.

IPv4 → IPv6 mapping
IPv4-mapped IPv6 (dotted)::ffff:192.0.2.33
IPv4-mapped IPv6 (hex)::ffff:c000:0221
IPv4-compatible (deprecated)::192.0.2.33
6to4 prefix2002:c000:0221::/48

The four mapping forms

The same IPv4 address 192.0.2.33 can be written in IPv6 in these representative forms:

  • IPv4-mapped (dotted): ::ffff:192.0.2.33 — the standard form sockets use to carry IPv4 over IPv6.
  • IPv4-mapped (hex): ::ffff:c000:0221 — the exact same bits written as hex groups.
  • IPv4-compatible (deprecated): ::192.0.2.33 — deprecated by RFC 4291 and no longer used.
  • 6to4 prefix: 2002:c000:0221::/48 — the IPv4 address encoded as a 6to4 tunnel site prefix.

The ::ffff:0:0/96 mapped range

IPv4-mapped IPv6 addresses live in the ::ffff:0:0/96 range: the top 80 bits are all zero, the next 16 bits are ffff, and the final 32 bits hold the original IPv4 address. Dual-stack sockets use exactly this range to express IPv4 connections inside the IPv6 address space. The hex value is built from the high and low 16 bits of ipv4ToInt, each padded to four digits.

Representation comparison (for 192.0.2.33)

Here is how the same IPv4 address 192.0.2.33 looks across every form, side by side.

FormNotationRange / statusUsed for
IPv4-mapped (dotted)::ffff:192.0.2.33::ffff:0:0/96 · standardDual-stack sockets, human-readable logs
IPv4-mapped (hex)::ffff:c000:0221::ffff:0:0/96 · standardSame bits, written as pure IPv6 groups
IPv4-compatible::192.0.2.33::/96 · deprecated (RFC 4291)Do not use; legacy parsing only
6to4 prefix2002:c000:0221::/482002::/16 · mostly deprecatedSite prefix for IPv6-over-IPv4 tunnels

Worked example: 192.0.2.33 → ::ffff:c000:0221

Let's walk through how the hex mapped form is built, step by step.

  • Convert each octet to hex: 192 = 0xc0, 0 = 0x00, 2 = 0x02, 33 = 0x21.
  • Combine into a 32-bit integer: 0xc0000221.
  • Split it: high 16 bits = 0xc000, low 16 bits = 0x0221.
  • Append both groups after ::ffff: to get ::ffff:c000:0221.

The result sits inside the ::ffff:0:0/96 mapped range — exactly the form a dual-stack socket uses to express an IPv4 connection in the IPv6 address space. Going the other way, given::ffff:c000:0221 the tool reads the final 32 bits 0xc0000221 and expands them octet by octet back to 192.0.2.33.

Frequently asked questions

Why do I see addresses like ::ffff:192.0.2.33 in my logs?
When an IPv6 socket accepts an IPv4 connection, the OS represents that IPv4 peer as an IPv4-mapped IPv6 address. The traffic is still really IPv4.
How do IPv4-compatible (::192.0.2.33) and IPv4-mapped (::ffff:192.0.2.33) differ?
The compatible form was deprecated by RFC 4291 and is no longer used. Today IPv4 is only represented inside IPv6 using the mapped form with ffff.
What is a 6to4 prefix used for?
6to4 is a transition mechanism that tunnels IPv6 packets over the IPv4 internet, encoding an IPv4 address in hex after 2002::/16 to form a /48 site prefix. It is largely deprecated now but still useful for learning and parsing legacy configs.
Can I convert a mapped IPv6 back to IPv4?
Yes. Whether you enter ::ffff:a.b.c.d dotted notation or ::ffff:HHHH:HHHH hex notation, the tool decodes the last 32 bits and restores the original dotted IPv4 address.
Is the address I enter sent to a server?
No. All conversions run entirely in your browser, and the IP address you enter is never transmitted or stored anywhere.

Related tools

Network / IP