[ learn ]

IPv4 vs IPv6: what is the difference?

Updated · 4 min read

Short answer

IPv4 addresses are 32 bits long and written as four numbers, like 8.8.8.8, which allows about 4.3 billion addresses. IPv6 addresses are 128 bits long and written in hexadecimal, like 2001:4860:4860::8888, which allows about 3.4 × 1038: enough for every device to have its own public address without sharing.

At a glance

IPv4IPv6
Address size32 bits128 bits
Total addresses≈ 4.3 billion≈ 3.4 × 1038
Written asDecimal, dots: 192.0.2.10Hex, colons: 2001:db8::10
Typical home assignmentOne public address, often sharedA whole prefix, usually /56 or /64
NATAlmost alwaysNot needed
Address setupDHCP or manualSLAAC, DHCPv6 or manual
HeaderVariable, with checksumFixed 40 bytes, no checksum, simpler for routers

How the addresses are written

An IPv4 address is four numbers from 0 to 255 separated by dots. Each number is one byte.

An IPv6 address is eight groups of four hexadecimal digits separated by colons. Two rules shorten it: leading zeros in a group can be dropped, and one run of all-zero groups can be replaced with ::. So

2001:0db8:0000:0000:0000:ff00:0042:8329
2001:db8::ff00:42:8329          (same address)

In URLs an IPv6 address goes in square brackets, http://[2001:db8::1]:8080/, because the colons would otherwise clash with the port. On this site both kinds work directly in the address bar: /8.8.8.8 and /2001:4860:4860::8888.

Why IPv6 was needed

4.3 billion addresses looked like plenty in 1981. With phones, laptops, servers and smart devices, it is not. IANA handed out its last free IPv4 blocks in February 2011, and the regional registries ran out of their normal pools between 2011 and 2019. New networks now get small leftover blocks, or buy addresses on a transfer market.

IPv6 was standardised in the late 1990s (now RFC 8200) to fix this for good. The two are separate protocols: an IPv4-only device cannot talk directly to an IPv6-only one, so most networks run both side by side (dual stack).

NAT and CGNAT

To stretch IPv4, home routers use NAT: every device at home gets a private address (like 192.168.1.20) and the router shares one public address for all of them. Many ISPs, especially mobile operators, go further with carrier-grade NAT (CGNAT): hundreds or thousands of customers share a pool of public IPv4 addresses, using the special range 100.64.0.0/10 inside the ISP.

That has side effects. Incoming connections (game hosting, cameras, home servers) are hard or impossible, and when one user on a shared address misbehaves, a block or a bad reputation hits everyone behind it. It also makes IP geolocation less precise, because a CGNAT gateway can serve a whole region.

With IPv6 every device gets a globally unique address, and the router's firewall, not NAT, blocks unwanted incoming traffic. To limit tracking, devices use privacy addresses that change the last 64 bits regularly, while the network prefix stays the same.

How widely IPv6 is used

Adoption has grown steadily: Google's public statistics show close to half of its users connecting over IPv6. It varies a lot by country and network. Many large mobile and broadband operators in India, the US, France, Germany and Malaysia have rolled it out widely, while other networks are still IPv4-only. Websites behind major CDNs usually support both.

When both are available, your device tries both and uses whichever answers first (the "Happy Eyeballs" method, RFC 8305), which usually means IPv6.

How to check which one you use

Open What is my IP?. It shows the address your browser used to reach this site; if it contains colons, you are on IPv6. For a machine-readable answer use /json, or from a terminal:

curl https://ipinfo.dkly.net/json        # whichever your system prefers
curl -4 https://ipinfo.dkly.net/json     # force IPv4
curl -6 https://ipinfo.dkly.net/json     # force IPv6 (fails if you have none)

If the -6 request fails, your connection is IPv4-only. To look up any other address, use the IP lookup. The API accepts both versions in the same ip parameter; see the documentation.

[ FAQ ]

Frequently asked questions

Is IPv6 faster than IPv4?

Not by design. Speed depends on the route and the networks in between. IPv6 can be slightly faster on some networks because it avoids carrier-grade NAT, but for most users the difference is small.

Can IPv4 and IPv6 devices talk to each other directly?

No. They are separate protocols. Networks either run both at once (dual stack) or use translation such as NAT64 and DNS64 so IPv6-only devices can reach IPv4-only services.

Why do some sites show my IPv6 address and others my IPv4 address?

If your connection has both, your device uses IPv6 for sites that support it and IPv4 for sites that do not. So the address a site sees depends on whether that site is reachable over IPv6.

Will IPv4 be switched off?

Not soon. IPv4 will stay in use for many years alongside IPv6, helped by NAT and address trading. Some mobile networks already run IPv6-only internally and translate for IPv4 sites.

Last updated · All articles · API docs