IPv4 and IPv6 are two versions of the Internet Protocol: IPv4 uses 32-bit addresses such as 192.0.2.1, about 4.3 billion in total, while IPv6 uses 128-bit addresses such as 2001:db8::1, enough that the supply is effectively unlimited. Most connections run both side by side today, and your device prefers IPv6 when the network and the website both support it.
The two are not compatible on the wire. An IPv6 packet can't be read by an IPv4-only device, which is why the move has taken decades and why both still run in parallel ("dual stack").
IPv4 vs IPv6 at a glance
| IPv4 | IPv6 | |
|---|---|---|
| Specification | RFC 791 (1981) | RFC 8200 (current version) |
| Address size | 32 bits | 128 bits |
| Possible addresses | 232 = 4,294,967,296 | 2128, about 3.4 × 1038 |
| Written as | Four decimal numbers: 203.0.113.7 | Eight hex groups: 2001:db8:0:0:8:800:200c:417a |
| Header | 20 bytes minimum, variable, with a checksum | Fixed 40 bytes, no header checksum |
| Fragmentation | Routers may fragment packets | Only the sending host fragments |
| Finding local neighbours | ARP (broadcast) | Neighbor Discovery (multicast) |
| Broadcast | Yes | None; multicast instead |
| Loopback | 127.0.0.1 | ::1 |
| DNS record | A | AAAA |
| Usual home setup | One public address shared through NAT | Every device gets its own global address |
Why IPv6 exists: IPv4 ran out
4.3 billion addresses sounded like plenty in 1981. Phones, laptops, servers and connected devices outnumber that by a wide margin, and large blocks were also reserved for private networks, multicast and other special uses. The central pool ran dry first: the RIPE NCC announcement reads "The IANA IPv4 free pool was exhausted today, 3 February 2011." The regional registries then ran out of their own stocks over the following years.
The internet kept working on IPv4 mostly thanks to NAT, where one public address is shared by many private ones. Your home router does this. Many mobile and some home providers add a second, carrier-grade layer, so whole neighbourhoods share addresses. NAT works, but it breaks the idea that every device can be reached at its own address, which complicates hosting, gaming, VoIP and peer-to-peer apps. Public vs private IP addresses covers NAT in more detail. IPv6 removes the shortage, so NAT isn't needed to save addresses.
How to read an IPv6 address
An IPv6 address is eight groups of up to four hex digits, separated by colons. RFC 4291 allows two shortcuts, and you'll see both everywhere:
- Drop leading zeros in each group:
0db8becomesdb8,0000becomes0. - Replace one run of all-zero groups with
::. It can appear only once, or the address would be ambiguous.
Worked example, from RFC 4291:
2001:0DB8:0000:0000:0008:0800:200C:417A full
2001:DB8:0:0:8:800:200C:417A leading zeros dropped
2001:DB8::8:800:200C:417A zero run compressed
To expand an address, count the groups you can see (five here) and fill the :: with enough zero groups to reach eight (three here).
For a typical global address, the first 64 bits are the network prefix your provider gives you and the last 64 bits identify the interface; RFC 4291 requires 64-bit interface IDs for normal unicast addresses. The network gets the prefix, so every device on it can form its own address inside it. The /64 style of writing prefixes is the same CIDR notation IPv4 uses; see CIDR notation explained.
IPv6 addresses you'll recognise
| Address or prefix | Meaning | IPv4 counterpart |
|---|---|---|
::1 | Loopback, this machine | 127.0.0.1 |
:: | Unspecified, "no address" | 0.0.0.0 |
fe80::/10 | Link-local, only valid on the local network | 169.254.0.0/16 |
ff00::/8 | Multicast | 224.0.0.0/4 |
::ffff:192.0.2.1 | An IPv4 address written in IPv6 form (IPv4-mapped) | n/a |
2001:db8::/32 | Reserved for documentation, like the examples here | 192.0.2.0/24 |
In a URL, an IPv6 address goes in square brackets so its colons aren't confused with a port: http://[2001:db8::1]:8080/.
Other technical differences
Simpler header
RFC 8200 says some IPv4 header fields "have been dropped or made optional". The IPv6 header has a fixed set of fields: version, traffic class, flow label, payload length, next header, hop limit and the two 128-bit addresses. Optional information moves into extension headers chained after it. There is no header checksum, which RFC 8200 notes when it explains why upper-layer protocols must cover the addresses in their own checksums. The hop limit field plays the role of IPv4's TTL.
No fragmentation by routers
In IPv4, a router that meets a smaller link can split a packet. In IPv6, "fragmentation in IPv6 is performed only by source nodes, not by routers". Routers drop a too-large packet and send back an ICMPv6 "Packet Too Big" message, and the sender adjusts. IPv6 also requires every link to carry packets of at least 1280 bytes.
Neighbor Discovery replaces ARP
IPv4 finds a neighbour's MAC address with ARP broadcasts that every device on the network has to process. RFC 4861's Neighbor Discovery covers what ARP, ICMP Router Discovery and ICMP Redirect did in IPv4, using multicast, so devices that aren't the target are mostly left alone. What is a MAC address explains what is being looked up.
Addresses configure themselves
An IPv6 device can build its own global address from the prefix the router advertises (stateless autoconfiguration), with or without DHCPv6. Early implementations derived the interface part from the MAC address, a method described in RFC 4291's appendix. Because a fixed identifier in an address lets sites link your activity, RFC 8981 defines temporary addresses with randomized identifiers that change over time, On Windows, ipconfig lists them as Temporary IPv6 Address.
Is IPv6 more secure than IPv4?
Neither is secure by itself; encryption happens higher up, in TLS. The practical difference is exposure. Behind IPv4 NAT, unsolicited incoming connections fail as a side effect of address sharing. With IPv6, each device has a globally routable address, so the router's firewall is what blocks unsolicited inbound traffic. Check that your router's firewall blocks unsolicited inbound IPv6 traffic, not only IPv4.
How to check whether you're using IPv6
On Windows, run ipconfig and look under your active adapter. Example output from a network without IPv6 service:
Wireless LAN adapter Wi-Fi:
Link-local IPv6 Address . . . . . : fe80::1c2a:5bff:fe3d:9a10%30
IPv4 Address. . . . . . . . . . . : 192.168.1.251
Default Gateway . . . . . . . . . : 192.168.1.254
Only a link-local (fe80) address means the device speaks IPv6 locally but has no IPv6 internet access. A line reading IPv6 Address with an address starting with 2 or 3 means you have a global address: IANA's address-space registry allocates 2000::/3 as global unicast. On macOS and Linux, ifconfig or ip -6 addr shows the same; look for scope global on Linux.
To check what a website offers, ask DNS for its AAAA record (RFC 3596 defines it as the record that stores an IPv6 address):
nslookup -type=AAAA example.com
If the answer contains an IPv6 address and your device has a global IPv6 address, the connection will normally use IPv6. Test the loopback on any machine with ping ::1, which should reply immediately.
Do you need to do anything?
For most people, no. Operating systems, browsers and home routers handle dual stack automatically and fall back to IPv4 when IPv6 isn't available. The cases where you need to care:
- Running a server or self-hosting. Publish an AAAA record alongside the A record, and make sure the service listens on IPv6 (
::) as well as IPv4 and the firewall allows it. - Writing software. Don't parse addresses with a regex for dotted quads, store them in a field wide enough for 45 characters (the longest form,
0000:0000:0000:0000:0000:ffff:255.255.255.255), and bracket IPv6 literals in URLs. - Behind carrier-grade NAT with port forwarding problems. If your provider offers IPv6, it may give you a reachable address where IPv4 can't.
Frequently asked questions
- Is IPv6 faster than IPv4?
- Not inherently. Both carry data at the speed of the underlying link. Differences people measure come from the path: an IPv6 route may avoid a carrier-grade NAT device and be slightly quicker, or take a different route and be slightly slower. There is no general speed reason to prefer one.
- Should I disable IPv6?
- Usually no. Operating systems fall back to IPv4 when an IPv6 path fails, and some features and networks depend on IPv6 being present. Disabling it is a troubleshooting step for a specific broken network, not a general improvement, and it should be undone once the network is fixed.
- Can an IPv4-only device reach an IPv6-only website?
- Not directly, because the two protocols are separate and their packets are not compatible. It needs a translator in the path, such as NAT64 run by the network, or a proxy. In practice most sites are reachable over IPv4 as well, so IPv4-only devices still work for most of the web.
- Why does my computer have several IPv6 addresses?
- That is normal. Each interface has a link-local address starting with fe80 for the local network, and on an IPv6-enabled network it also gets one or more global addresses, often including temporary addresses that change over time for privacy, as defined in RFC 8981.
Sources
- RFC 791: Internet Protocol (IPv4)
- RFC 8200: Internet Protocol, Version 6 (IPv6) Specification
- RFC 4291: IP Version 6 Addressing Architecture
- RFC 4861: Neighbor Discovery for IP version 6
- RFC 8981: Temporary Address Extensions for Stateless Address Autoconfiguration in IPv6
- RFC 3596: DNS Extensions to Support IP Version 6
- IANA: IPv6 Special-Purpose Address Registry
- IANA: IPv4 Special-Purpose Address Registry
- IANA: Internet Protocol Version 6 Address Space
- RIPE NCC announcement: IPv4 Exhaustion, 3 February 2011