Skip to content
Addressing and routing

· 5 min read

IPv4 vs IPv6: what changed

IPv4 ran out of new addresses years ago, and IPv6 was built to replace it. Most connections now use both. This guide compares them, shows how to read an IPv6 address, and explains the one privacy trap that dual-stack networks create.

On this page

The difference in one sentence#

IPv4 addresses are 32 bits long, which allows about 4.3 billion of them. IPv6 addresses are 128 bits long, which allows about 3.4 × 10^38. Almost everything else that differs follows from that: the notation, the way networks are laid out, and whether devices need to share addresses at all.

An IPv4 address and an IPv6 address, side by sideThe IPv4 address 203.0.113.42 is four 8-bit numbers, shown in decimal and in binary, 32 bits in all. The IPv6 address 2001:db8::42 is eight 16-bit groups in hexadecimal, 128 bits in all, written 2001:0db8:0000:0000:0000:0000:0000:0042 in full. The first four groups are the network prefix and the last four identify the interface.IPv4 · 32 bits · four octets20311001011000000000113011100014200101010IPv6 · 128 bits · eight groups of 1620010db8000000000000000000000042network prefix (/64)interface identifierWritten short:2001:db8::42Runs of zero groups collapse to ::, once per address.
The same kind of information at two sizes: 32 bits as four decimal numbers, 128 bits as eight hexadecimal groups.

IPv4 and IPv6 compared#

Side by side
IPv4IPv6
Address length32 bits128 bits
NotationDotted decimal: 203.0.113.42Colon-separated hex: 2001:db8::42
Number of addresses4,294,967,296340,282,366,920,938,463,463,374,607,431,768,211,456
Header size20 to 60 bytes, variableFixed 40 bytes
Header checksumYesNo: left to the layers above and below
FragmentationBy the sender and by routers on the wayBy the sender only
BroadcastYesNo: multicast is used instead
Automatic configurationDHCPRouter advertisements (SLAAC), and DHCPv6 if wanted
Address sharing (NAT)Routine, because of the shortageNot needed for address supply
Typical home subnet192.168.1.0/24A /64 from a /56 or /48 your ISP delegates

The specifications are RFC 791 for IPv4 and RFC 8200 for IPv6.

Why the internet still runs both#

IANA handed out the last unallocated IPv4 blocks to the regional registries in February 2011, and the registries have since run out or nearly so. Networks coped in three ways: NAT to share one public address among many devices, a market in which unused blocks are bought and sold, and carrier-grade NAT at the ISP.

IPv6 solves the shortage outright, but it cannot simply replace IPv4. The two do not interoperate directly: an IPv6-only device cannot open a connection to an IPv4-only server without a translator in between. So networks run dual-stack, with both, and every connection picks whichever the destination supports. That is why this site shows an IPv4 and an IPv6 address on the home page, and why a lookup for a site can return both.

Adoption is uneven by country and by ISP. Google publishes what share of its users arrive over IPv6 on its IPv6 statistics page, and APNIC Labs measures it from a different angle, so you can watch it change instead of trusting a figure in an article.

How to read an IPv6 address#

An IPv6 address is eight groups of four hexadecimal digits. Two rules shorten it, and only these two:

  1. Leading zeros in a group can be dropped. 0db8 becomes db8, and 0042 becomes 42.
  2. One run of consecutive all-zero groups can be replaced by `::`. Only one run, because two would make it impossible to tell how many groups each stands for. When two runs tie, RFC 5952 says to shorten the longer one, or the first if they are equal.
The same address in three forms, and three you will meet
2001:0db8:0000:0000:0000:0000:0000:0042   full form
2001:db8:0:0:0:0:0:42                     leading zeros dropped
2001:db8::42                              zero run collapsed

::1                                        loopback, like 127.0.0.1
::                                         "no address", all zeros
fe80::1                                    link-local, valid on one link only

The first half of a typical address is the network prefix, which your ISP and router decide, and the second half is the interface identifier, which identifies the device on that network. A /64 is the standard size of one subnet. CIDR and subnetting covers the notation, and the subnet calculator accepts IPv6 prefixes too.

What changes for privacy#

The dual-stack leak

A VPN or proxy has to cover both families. One that only tunnels IPv4 leaves your IPv6 traffic going straight out through your ISP, and any site with an IPv6 address will see your real one. The symptom is a VPN that shows a foreign IPv4 address and a home IPv6 address at the same time. The leak test probes each family separately for exactly this.

Addresses that change on purpose

Early IPv6 addresses often embedded the device's hardware address, which made the same device recognisable on every network it joined. Modern systems use temporary addresses that rotate (RFC 4941) and stable but opaque ones per network, so the address you see for outbound connections is normally not one you can be followed by across networks.

No NAT does not mean no protection

With IPv6, every device can have a globally routable address. That is not the same as being reachable: home routers ship with a stateful firewall that blocks unsolicited inbound connections. It does mean the router no longer hides how many devices you have, because each one appears under its own address.

Which one are you using?#

The home page shows both, each probed separately, so you can see whether you have IPv6 at all. From a terminal, this site's plain-text endpoint answers on both families, so you can force each one:

Force each family with curl
curl -4 https://my-ip-address.in/ip     # your IPv4 address, or an error if you have none
curl -6 https://my-ip-address.in/ip     # your IPv6 address, or an error if you have none

If the second command fails and you expected an address, your network or ISP is not offering IPv6, which is common and not a fault. If both work and the two answers look like different people, that is normal too: they are different addresses on the same connection. Paste either into a lookup to see who owns it.

Common questions#

Is IPv6 faster than IPv4?

Not inherently. Measurements vary by network and are often within a few milliseconds of each other. Where IPv6 helps is avoiding carrier-grade NAT, which can add a hop and a bottleneck.

Why did the numbering skip from IPv4 to IPv6?

Version number 5 had already been assigned to an experimental streaming protocol, the Internet Stream Protocol, which never came into general use. The number was skipped rather than reused.

Will IPv4 be switched off?

There is no date. Both will coexist for the foreseeable future, and a growing share of traffic reaches IPv6-capable services over IPv6 without anyone noticing.

Try it on your own connection

Sources and further reading

Keep reading

Published by My IP Address