IPv6 to IPv4 Converter

Paste an IPv6 address to get the IPv4 address inside it, see where its 32 bits sit and which format put them there. Most IPv6 addresses carry no IPv4 at all, and the converter says so.

RFC 4291, 6052, 3056, 4380 and 5214 decoders · checked against each RFC's own examples · runs in your browser

Read as IPv6

Where the IPv4 sits in the 128 bitsIPv4-mapped
Try

Any IPv6 spelling, with brackets, a port, a %zone or a /prefix. Converted in your browser; nothing is sent.

IPv4 insideIPv4-mappedIn use

203.0.113.5

::ffff:0:0/96 · RFC 4291

Seen in a server log? This visitor came over IPv4, from 203.0.113.5: a dual-stack server writes IPv4 clients this way.

IPv4
Compressed (RFC 5952)
Expanded (full)
IPv4 as a number
Decimal · hex · binary
Reverse DNS name

How do I convert IPv6 to IPv4?

You can convert an IPv6 address to IPv4 only when an IPv4 address is already written inside it: find the format from the address's first bits, take the 32 bits that format reserves, and read them as four decimal numbers.

The converter does all three steps. In ::ffff:203.0.113.5 the first 96 bits are the IPv4-mapped prefix ::ffff:0:0/96 (RFC 4291), so the last 32 bits are the IPv4 address: cb00:7105 in hex, which is cb = 203, 00 = 0, 71 = 113 and 05 = 5.

Other formats put the 32 bits elsewhere: 6to4 right after 2002:, a network's NAT64 prefix around a skipped octet, Teredo inverted at the end. The ribbon in the tool shows where they sit in each address you type.

1Read the prefix::ffff:0:0/96 IPv4-mapped prefix
2Take the 32 bits96–127 · cb00:7105
3Each byte in decimalcb20300071113055203.0.113.5
The three steps on a mapped address from a server log. Documentation address (RFC 5737).
IPv6 to IPv4 converter decoding a Teredo address into its server and client IPv4 addressesIPv6 to IPv4 converter decoding a Teredo address into its server and client IPv4 addressesOne field, any spellingBrackets, ports, zones, prefixes, URLs and reverse names are read; the line under the field says how.The prefixThe first bits name the format, here Teredo's 2001::/32 from RFC 4380.Inverted bits, flipped backTeredo stores the client's port and IPv4 inverted; the row under them is the real value.The IPv4 addressEach lit byte in decimal, and the whole address under its bracket.The verdictIPv4 inside, the format, its status today, and what it means for you.Every form, ready to copyThe server, port, flags, the canonical IPv6 text, the full form and the reverse DNS name.
A Teredo address taken apart: the server, the flags, and the client's port and IPv4, both stored inverted.

Does every IPv6 address contain an IPv4 address?

No. An ordinary IPv6 address holds no IPv4 address at all; only a handful of formats embed one, and each announces itself with a known prefix or interface ID.

RFC 4291 tells software not to read structure into an IPv6 address beyond what its prefix defines, so a tool that turns 2001:db8:85a3::8a2e:370:7334 into an IPv4 address is inventing one. The formats that carry an IPv4 address are drawn here with where their 32 bits sit.

Only two are common today: IPv4-mapped addresses inside software, and NAT64 addresses on IPv6-only networks. 6to4 and Teredo have practically vanished from real traffic.

Where each format keeps the IPv4 address 192.0.2.33, drawn to scale: 32 hex digits, 4 bits each.

Why do my logs show ::ffff: addresses?

Because your server listens on one IPv6 socket for both protocols, and the operating system shows IPv4 visitors to it as IPv4-mapped addresses: ::ffff:203.0.113.5 is the IPv4 visitor 203.0.113.5, not an IPv6 one.

This is the dual-stack socket of RFC 3493. The mapped form exists only inside software: IANA marks ::ffff:0:0/96 as not forwardable and not globally reachable, so no packet on the internet carries it.

To report or block that visitor, use the plain IPv4 address. Tools disagree on how they print it: Go's older net package shows 203.0.113.5, while net/netip and Python 3.13 show ::ffff:203.0.113.5, so one visitor can appear both ways.

IPv4 visitor203.0.113.5IPv4
IPv6 visitor2001:db8::7IPv6
Your server[::]:443one IPv6 socket
access.log
::ffff:203.0.113.5 - - [24/Oct/2026:09:14:02 +0000] "GET / HTTP/1.1" 200
2001:db8::7 - - [24/Oct/2026:09:14:05 +0000] "GET / HTTP/2" 200
One socket, two families: the operating system writes the IPv4 visitor as ::ffff:203.0.113.5.

How does NAT64 put an IPv4 address inside IPv6?

A NAT64 network gives every IPv4 host an IPv6 address by writing its IPv4 address into a prefix, 64:ff9b::/96 by default, so 192.0.2.33 becomes 64:ff9b::c000:221.

On an IPv6-only network, DNS64 answers a name that has only an A record with a made-up AAAA record built this way, and the translator turns packets to that address into IPv4. Devices find their network's prefix by asking for ipv4only.arpa.

A network can use its own prefix of 32, 40, 48, 56, 64 or 96 bits (RFC 6052). Bits 64–71 then stay zero, so with /40, /48 and /56 the IPv4 address is split around that octet. The address alone doesn't say which length a network chose, which is why the tool asks. The well-known prefix must never carry a private IPv4 address.

RFC 6052's own examples for 192.0.2.33: prefix bits white, the IPv4 green, the u-octet hatched.

What is a Teredo address?

A Teredo address is an IPv6 address for a computer behind IPv4 NAT, tunnelled over UDP; it holds the Teredo server's IPv4 address and, inverted, the client's public IPv4 address and port.

It has five parts: the prefix 2001::/32, the server's IPv4 address in bits 32–63, 16 flag bits, the UDP port the client's NAT assigned, and the client's public IPv4 address, the last two with every bit inverted (RFC 4380).

Since RFC 5991, 12 of the 16 flag bits are random, so flags other than 0x8000 are normal. Teredo is practically gone from today's internet, but old logs and firewall rules still hold its addresses.

2001:0:c000:201:8000:63bf:34ff:8efa decoded: server 192.0.2.1, cone flag, port 40000, client 203.0.113.5.

What are 6to4 and ISATAP addresses?

6to4 and ISATAP were early ways to carry IPv6 over IPv4 networks, and both write an IPv4 address into the IPv6 address: 6to4 right after 2002:, ISATAP in the interface ID after 5efe.

A 6to4 site's prefix is 2002: followed by its public IPv4 address, so 192.0.2.33 owned 2002:c000:221::/48. RFC 7526 retired the anycast relays that made 6to4 work across the internet, not the format.

ISATAP builds the last 64 bits from 0:5efe, or 200:5efe for a public IPv4 address, followed by the IPv4 address, under any /64 prefix.

Both formats, and how their traffic disappeared (Google's IPv6 statistics).

How do I get my IPv4 address from IPv6?

Look it up on its own: your IPv4 and IPv6 addresses are two independent addresses, your IPv6 address doesn't contain the IPv4 one, and What Is My IP shows both side by side.

A dual-stack connection has an IPv4 address, often shared through the provider's NAT, and an IPv6 prefix; each website reaches you over whichever one your browser picks. The converter helps only with addresses in the embedded formats, such as a mapped address in a log.

On an IPv6-only mobile network, your apps' IPv4 traffic goes through the provider's 464XLAT, and the IPv4 address websites see belongs to the provider's translator.

Two addresses, two lanes: neither address can be worked out from the other. Documentation addresses.

How do I force IPv4 instead of IPv6?

Make your computer prefer IPv4 rather than switch IPv6 off: computers try IPv6 first when a name has both kinds of address, and raising IPv4 in the address-selection table changes that while IPv6 keeps working.

Microsoft recommends exactly this on Windows and warns against disabling or unbinding IPv6, which can stop parts of Windows from working. On a Mac, System Settings has no off switch for IPv6. On Linux, one line in /etc/gai.conf does it, though Chrome sorts addresses itself.

For a single command, most tools take -4. The tabs show each system's steps, checked against the vendor's own documentation.

The address-selection table

DefaultPrefer IPv4
IPv6 (::/0)4040
IPv4 (::ffff:0:0/96)35100

RFC 6724 §2.1, §10.3

In a prompt run as administrator, then restart:
› reg add "HKLM\SYSTEM\CurrentControlSet\Services\Tcpip6\Parameters" /v DisabledComponents /t REG_DWORD /d 32 /f
Check: the ::ffff:0:0/96 row now outranks ::/0
› netsh interface ipv6 show prefixpolicies
One command only:
› ping /4 example.com
› tracert /4 example.com
System Settings has no Off for IPv6; this turns it off for one service:
› networksetup -listallnetworkservices
› networksetup -setv6off "Wi-Fi"
Undo:
› networksetup -setv6automatic "Wi-Fi"
ping is already IPv4-only on a Mac (ping -4 is an error).
Add to /etc/gai.conf, and copy glibc's other default lines too: one precedence line replaces the whole table.
› precedence ::ffff:0:0/96 100
One command only:
› ping -4 example.com
Chrome may not follow gai.conf: it sorts addresses itself.
In about:config:
› network.dns.disableIPv6 = true
Chrome has no such setting; on Windows it follows the system's preference.
› curl -4 https://example.com
› wget -4 https://example.com
› ssh -4 user@example.com
› nslookup -type=A example.com
dig -4 only changes how dig reaches the DNS server: ask for A records instead.
› dig A example.com
Prefer IPv4 without turning IPv6 off: the selection table, then each system's steps from its vendor's documentation.

Frequently asked questions

Can every IPv6 address be converted to IPv4?

No. An IPv6 address can only be turned into IPv4 when an IPv4 address was written into it, as in the IPv4-mapped, NAT64, 6to4, Teredo and ISATAP formats. A native address such as 2001:db8:85a3::8a2e:370:7334 carries no IPv4 address, and any tool that prints one for it is making it up. For a website's IPv4 address, look up its A record instead.

What is the IPv4 address in ::ffff:192.0.2.1?

It is 192.0.2.1. The prefix ::ffff:0:0/96 marks an IPv4-mapped address: 80 zero bits, 16 one bits, then the IPv4 address in the last 32 bits. Written in hex the same address is ::ffff:c000:201, because c0 is 192, 00 is 0, 02 is 2 and 01 is 1. Software shows IPv4 peers this way when it uses one IPv6 socket for both protocols.

How do I convert a 64:ff9b:: address to IPv4?

Take the last 32 bits. 64:ff9b::/96 is NAT64's well-known prefix, so 64:ff9b::c000:221 is the IPv4 host 192.0.2.33, also written 64:ff9b::192.0.2.33. You see these addresses on IPv6-only networks, where DNS64 builds them from a host's A record and a NAT64 translator carries the traffic to IPv4. The prefix must never hold a private IPv4 address.

Why does the converter ask for my network's NAT64 prefix length?

Because a network may use its own NAT64 prefix of 32, 40, 48, 56, 64 or 96 bits, and where the IPv4 address sits depends on that length. With a /48, for example, the IPv4 address is split around bits 64 to 71, which are always zero. The address alone can't tell you the length, and RFC 8215 forbids guessing for the 64:ff9b:1::/48 block, so the tool lists every candidate.

What is an IPv4-compatible IPv6 address?

It is an old format, ::/96, that put an IPv4 address in the last 32 bits after 96 zero bits, as in ::192.0.2.1. RFC 4291 deprecated it and current transition mechanisms don't use it, so you mostly meet it in old configurations and firewall exports. The converter still reads it and marks it deprecated, and it never treats :: or ::1 as IPv4.

How do I get the IPv4 address from an IPv6 address in Python?

Use the ipaddress module. On an IPv6Address, .ipv4_mapped returns the IPv4 address inside ::ffff:0:0/96, .sixtofour the one inside 2002::/16, and .teredo a pair of the server and client addresses inside 2001::/32; each is None for other addresses. Python has no property for NAT64 or ISATAP, so for those take the right 32 bits yourself, as this converter does.

Does converting an address change my connection?

No. The converter only reads the text you type and shows what is written inside it; nothing on your computer or network changes, and nothing is sent anywhere. To actually use IPv4 instead of IPv6, change your computer's address preference, as the section on forcing IPv4 explains. To see the IPv4 address your connection has, open What Is My IP.

How do I prefer IPv4 over IPv6 on Windows?

Set the registry value DisabledComponents to 0x20 under HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip6\Parameters from an administrator prompt, then restart; Microsoft recommends this instead of disabling IPv6. Check it with netsh interface ipv6 show prefixpolicies: the ::ffff:0:0/96 row must outrank ::/0. For a single command, ping /4 and tracert /4 use IPv4 only. Microsoft advises against unticking IPv6 on the adapter.

Why are 6to4 and Teredo addresses so rare now?

Their relays and servers have been switched off almost everywhere. In Google's measurements about two-thirds of IPv6 users reached Google through 6to4 or Teredo in September 2008, and none have since July 2021. RFC 7526 retired 6to4's anycast relays, though not the 2002::/16 format itself. You can still meet these addresses in old logs, firewall rules and documentation.

Is the address I paste sent to your server?

No. The conversion runs in your browser with the page's own code, which is why the answer appears as you type. A copied link keeps the address after a # in the URL, a part browsers never send to a server, so whoever opens it sees the same result. Only if the page's script fails to load does the Convert button fall back to an ordinary page request. Nothing is stored.

Missing something?Suggest a feature or a new tool