IPv4 in IPv6 Notation

The four ways an IPv4 address appears inside IPv6 — and why none of them is “your IPv6 address”.

Try 8.8.8.8, 192.168.1.1 or 127.0.0.1.

There is no IPv6 equivalent of an IPv4 address. IPv6 addresses are assigned by your provider, not derived from what you already have. What follows is four different notations that embed an IPv4 address, each for a different purpose — none of them is an address you can put in a DNS record and expect to work.

IPv4-mapped

Current

::ffff:203.0.113.5

How a dual-stack socket represents an IPv4 peer to an IPv6-only application. You will see these in server logs on dual-stack machines — an entry reading ::ffff:203.0.113.5 is an ordinary IPv4 connection, not an IPv6 one. Also written ::ffff:cb00:7105.

IPv4-compatible

Deprecated

::203.0.113.5

An early transition mechanism, deprecated by RFC 4291 in 2006 and no longer implemented. Included because it still turns up in old documentation and configuration files, where it should be treated as a bug rather than copied.

6to4 prefix

Deprecated

2002:cb00:7105::/48

Automatic tunnelling that gave any host with a public IPv4 address a /48 of IPv6 space. Deprecated by RFC 7526 — it depended on public relays whose quality nobody could guarantee, and it produced connections that failed in ways users could not diagnose.

NAT64 / well-known prefix

Only inside a NAT64 network

64:ff9b::203.0.113.5

How an IPv6-only client reaches an IPv4-only server through a NAT64 gateway. Real and current, but only meaningful inside a network that runs one — the address means nothing on the open internet.

The address itself

Dotted decimal
203.0.113.5
Hexadecimal
0xCB007105
32-bit integer
3,405,803,781
Binary
11001011.00000000.01110001.00000101

DocumentationTEST-NET (RFC 5737) — reserved for examples. Safe to publish, never routed.

The premise is usually wrong, and that is fine

Most people who search for an IPv4-to-IPv6 converter are looking for something that does not exist: a function that takes the address they have and returns the IPv6 address they should use. There is no such function. IPv6 addresses are allocated — your ISP or hosting provider hands you a block out of one handed to them — not computed from an IPv4 address you already own.

What does exist are several notations that place an IPv4 address inside IPv6 syntax, each invented for a specific job. Knowing which is which is genuinely useful, because you will meet them in logs and configuration files. Treating any of them as “your IPv6 address” is not.

The one you will actually see

::ffff:203.0.113.5 — the IPv4-mapped form — accounts for nearly every real-world sighting. It appears when a program listens on an IPv6 socket and an IPv4 client connects: the operating system presents the peer in this form so the application only has to handle one address type.

The practical consequence bites in two places. Log analysis that expects dotted quads will not match these lines. And an allow-list comparing strings will fail to match ::ffff:203.0.113.5 against 203.0.113.5 — a rule that looks correct, passes review, and silently never fires. Normalise before comparing.

What the others are

IPv4-compatible (::203.0.113.5) was an early transition idea, deprecated by RFC 4291 in 2006 and implemented by nothing current. If you find one in a config file, it is a bug rather than a choice.

6to4 (2002::/16) gave anyone with a public IPv4 address an automatic /48 of IPv6, tunnelled through public relays. Deprecated by RFC 7526 in 2015 — the relays had no accountable operator, and the failures were the worst kind: intermittent, slow, and impossible for a user to diagnose.

NAT64 (64:ff9b::/96) is current and in daily use. Mobile carriers in particular run IPv6-only networks and translate at the edge, so an IPv6-only handset reaches IPv4-only services this way. It is real, but it is a property of a network you are inside, not an address you can hand out.

Why the two protocols cannot simply talk

A reasonable question, given thirty years of transition. The answer is that IPv6 is not IPv4 with longer addresses — it is a different protocol with a different header, and a router handling one has no way to forward a packet of the other. There is nowhere in an IPv4 header to put a 128-bit address.

So every path between them needs something in the middle: a dual-stack host running both, a translator like NAT64, or a proxy that terminates one connection and originates another. That is the entire reason the transition has been slow, and why the practical answer to “how do I support IPv6?” is almost always “run dual-stack” rather than “convert something”.

Related

To see which protocol you are actually reaching the internet over, the IP checker reports the address family your connection used. For subnetting the address you have, the subnet calculator covers the IPv4 side.

Questions this page exists to answer

What is the IPv6 equivalent of my IPv4 address?

There is not one, and this is the most important thing on the page. IPv6 addresses are assigned by whoever provides your connectivity — they come from your ISP or your hosting provider, out of a block allocated to them. You cannot derive one from an IPv4 address you already hold, any more than you could derive a phone number from a postal address. What the notations here do is embed an IPv4 address inside IPv6 syntax for specific technical purposes, which is a different thing.

Why does my server log show ::ffff:203.0.113.5?

Because the socket is listening on IPv6 and the connection arrived over IPv4. A dual-stack socket represents IPv4 peers to the application in that IPv4-mapped form so the code only has to handle one address type. It is an ordinary IPv4 connection. If you are parsing logs or matching addresses against an allow-list, strip the ::ffff: prefix first — treating it as a distinct address is a common source of rules that silently fail to match.

Should I use a 6to4 address?

No. 6to4 was an automatic tunnelling mechanism that gave any host with a public IPv4 address a /48 of IPv6 space via the 2002::/16 prefix. It was formally deprecated by RFC 7526 in 2015 because it relied on public relay routers that nobody was accountable for, producing connections that were slow or broken in ways users could not diagnose. If you need IPv6, get it from your provider or use a tunnel broker with an accountable operator.

What is 64:ff9b:: for?

It is the well-known prefix for NAT64, defined in RFC 6052. An IPv6-only client that needs to reach an IPv4-only server sends to 64:ff9b:: with the IPv4 address embedded in the last thirty-two bits; a NAT64 gateway on the path translates. It is current and widely deployed — most notably by mobile carriers running IPv6-only networks. It only means anything inside a network that operates such a gateway, though; the address is not routable on the open internet.

Are IPv4 and IPv6 hosts able to talk to each other directly?

No. They are separate protocols with different packet formats, and there is no direct interoperation — this is precisely why the transition has taken thirty years. Communication between them always requires something in the middle: a dual-stack host that speaks both, a translator such as NAT64, or a proxy that terminates one and originates the other. That is also why "just convert the address" is not a solution to anything.

Last reviewed . Found something out of date? Tell us.