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-mapped IPv6 (dotted) | ::ffff:192.0.2.33 |
|---|---|
| IPv4-mapped IPv6 (hex) | ::ffff:c000:0221 |
| IPv4-compatible (deprecated) | ::192.0.2.33 |
| 6to4 prefix | 2002: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.
| Form | Notation | Range / status | Used for |
|---|---|---|---|
| IPv4-mapped (dotted) | ::ffff:192.0.2.33 | ::ffff:0:0/96 · standard | Dual-stack sockets, human-readable logs |
| IPv4-mapped (hex) | ::ffff:c000:0221 | ::ffff:0:0/96 · standard | Same bits, written as pure IPv6 groups |
| IPv4-compatible | ::192.0.2.33 | ::/96 · deprecated (RFC 4291) | Do not use; legacy parsing only |
| 6to4 prefix | 2002:c000:0221::/48 | 2002::/16 · mostly deprecated | Site 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.