IPv4 vs IPv6: what is the difference, and do you need both?

By Jelle · Updated

IPv4 and IPv6 are two versions of the protocol that gives every device on a network its address. They are not compatible with each other, so most networks run both side by side.

Address size and notation

An IPv4 address has 32 bits, written as four decimal numbers, for example 192.0.2.10. That allows roughly 4.3 billion addresses, which is fewer than the number of internet-connected devices today.

An IPv6 address has 128 bits, written as eight groups of hexadecimal digits, for example 2001:db8:0:0:0:0:0:1. Two rules make these shorter: leading zeros in a group can be dropped, and one run of all-zero groups can be replaced by ::. The address above becomes 2001:db8::1.

Side by side

IPv4IPv6
Address length32 bits128 bits
NotationDotted decimalHexadecimal with colons
Address spaceAbout 4.3 billionAbout 3.4 × 1038
Header20 to 60 bytes, variable40 bytes, fixed
BroadcastYesNo, uses multicast
Typical home setupPrivate addresses plus NATEvery device gets a global address

Why IPv4 is still everywhere

Network address translation (NAT) lets a whole household share one public IPv4 address, and providers go further with carrier-grade NAT, where many customers share one. This stretched IPv4 by decades, and it also means a lot of software and infrastructure was built around it. Switching everything off is not realistic.

Dual stack: using both

On a dual-stack network, a device has both an IPv4 and an IPv6 address. When it connects to a site that offers both, it tries them in parallel and uses the one that answers first, with a slight preference for IPv6. This behaviour is known as Happy Eyeballs (RFC 8305). If one protocol is broken, users usually do not notice, which is exactly the point.

Things that change with IPv6

Check what your connection supports

Ask the IP service for each protocol separately:

curl -4 -s https://whatsmyip.haasje.net
curl -6 -s https://whatsmyip.haasje.net

The IPv6 check on the web version does the same in the browser. To see the addresses on your own machine:

# Linux
ip -6 addr

# Windows
ipconfig

Do you need both?

In practice, yes. Keep IPv4 for the parts of the internet that are still IPv4-only, and enable IPv6 where your provider offers it. Disabling IPv6 on a client rarely solves anything and can cause slow connections, because applications then have to wait for fallbacks. If something breaks, look at it with curl -4 and curl -6 instead of turning a protocol off.

For the difference between addresses on your own network and the one the internet sees, read public vs private IP addresses.