IPv4 vs IPv6
How IPv4 and IPv6 differ in address size, notation, headers and everyday use, with worked examples of shortening addresses and subnets.
By the tools4free.dev team · Last reviewed 4 December 2026
IPv4 and IPv6 are two versions of the Internet Protocol, the system that gives devices addresses and carries packets between them. IPv4 uses 32-bit addresses, which allow about 4.3 billion in total. IPv6 uses 128-bit addresses, which allow about 3.4 x 10^38. IPv6 was created mainly because IPv4 addresses ran short, and today most networks run both side by side. This guide compares them in practice and shows how to read and shorten each kind of address.
The size difference in numbers
An IPv4 address is 32 bits, so there are 2^32 = 4,294,967,296 possible values. That sounded enormous in 1981, when IPv4 was specified in RFC 791, but the pool of unallocated blocks was exhausted at the registry level years ago. An IPv6 address, defined in RFC 8200, is 128 bits, giving 2^128, which is 340,282,366,920,938,463,463,374,607,431,768,211,456 values. Even one single IPv6 subnet of the usual size, a /64, holds 2^64 = 18,446,744,073,709,551,616 addresses, exactly the entire IPv4 address space squared.
Side-by-side comparison
| Feature | IPv4 | IPv6 |
|---|---|---|
| Address length | 32 bits | 128 bits |
| Written as | Four decimal numbers: 192.0.2.10 | Eight groups of hex: 2001:db8::10 |
| Header | 20 bytes minimum, with options | Fixed 40 bytes, extensions in separate headers |
| Header checksum | Yes | No (left to link and transport layers) |
| Fragmentation | By routers or the sender | By the sender only |
| Minimum link size | 68 bytes | 1280 bytes |
| Address assignment | Manual, DHCP | Manual, SLAAC, DHCPv6 |
| NAT in typical home use | Almost universal | Not needed for address supply |
| DNS record | A | AAAA |
| Private space | 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16 | Unique local fc00::/7 |
The fixed header and the removal of the checksum let routers process IPv6 packets simply. In everyday use the difference in speed is small, and a well-connected IPv4 path can beat a poor IPv6 one, and the other way round.
Reading and shortening IPv6 addresses
A full IPv6 address is eight groups of four hexadecimal digits separated by colons. Two rules make it shorter, set out in RFC 5952:
- Drop leading zeros in each group (
0db8becomesdb8). - Replace one run of consecutive all-zero groups with
::. You may do this only once, or the address would be ambiguous. If there is a tie, use it on the longest run.
Worked example 1. Shorten 2001:0db8:0000:0000:0000:ff00:0042:8329. Dropping leading zeros gives 2001:db8:0:0:0:ff00:42:8329. The three consecutive zero groups collapse to ::, giving 2001:db8::ff00:42:8329. To expand it back, count the groups present (five: 2001, db8, ff00, 42 and 8329), subtract from eight, and put the three missing zero groups where the :: is.
In a URL an IPv6 address goes in square brackets, because the colons clash with a port number: http://[2001:db8::10]:8080/.
Worked example 2: how much address space a site gets
A small office on IPv4 might be given one public address and a private network such as 192.168.1.0/24. That /24 holds 256 addresses, of which 254 are usable for hosts (the first is the network address and the last the broadcast). All of the devices share the one public address through NAT.
The same office on IPv6 might be delegated a /56 by its provider, which contains 2^8 = 256 separate /64 subnets. Each /64 can hold 2^64 devices, so there is no need to count addresses or share one. Every device can have its own globally unique address, and a firewall, not NAT, decides what may connect to it.
What changes for you in practice
Dual stack
Most networks run dual stack: devices have both an IPv4 and an IPv6 address, and applications use whichever works. Browsers follow an approach called Happy Eyeballs (RFC 8305), starting an IPv6 attempt and quickly trying IPv4 as well, so a broken IPv6 path rarely causes a long delay.
NAT is not a firewall
Home NAT happens to block unsolicited inbound connections to IPv4 devices. IPv6 gives each device a public-capable address, so the protection must come from the router's stateful firewall. Home routers generally enable this by default, but it is worth confirming.
Privacy addresses
Early IPv6 addressing built the lower 64 bits from the device's hardware (MAC) address, which would let a device be tracked between networks. Current operating systems use randomised, temporary addresses for outgoing connections, described in RFC 8981.
Address types to recognise
::1is the loopback, like 127.0.0.1.fe80::/10are link-local addresses, valid on one network segment only.fc00::/7unique local addresses play the role of private IPv4 space.2000::/3is where global unicast addresses are allocated.
Moving between the two worlds
An IPv6-only device cannot talk directly to an IPv4-only server, so networks use translation. A common design places a DNS64 resolver and a NAT64 gateway at the edge: when the device asks for the AAAA record of an IPv4-only site, DNS64 invents an IPv6 address that points at the gateway, and the gateway translates the packets to IPv4. Mobile carriers use this widely, so phones often live on IPv6 alone without the user noticing. Going the other way, an IPv4-only network can still reach IPv6 sites through a tunnel or a provider-supplied service, though a native dual-stack link is simpler to manage and troubleshoot.
For a site owner, the practical test is simple: does the service answer on both an A and an AAAA record, with the same content and the same certificate? Keeping the two paths equal avoids the odd case where only part of your audience sees a problem.
Common mistakes
- Using
::twice in the same address. - Assuming IPv6 means "no firewall needed" or, the opposite, blocking all IPv6 and forgetting it. Manage both.
- Comparing IPv6 addresses as strings. The same address can be written in several forms; normalise before comparing or storing.
- Storing addresses in a 15-character field. The longest IPv6 text form is 39 characters, and 45 if it embeds an IPv4 address.
- Allow-listing only IPv4 addresses and then wondering why a user on IPv6 is blocked, or the reverse.
- Forgetting AAAA records. A site with a working IPv6 address but no AAAA record will never be reached over IPv6.
- Using a subnet other than /64 for ordinary LAN segments, which breaks automatic address configuration.
- Assuming the address you see in "what is my IP" is the same for every site. A dual-stack device may show different addresses depending on which protocol a service uses.
Checking which one you are using
Ask a service that reports the address it sees. If it shows an IPv4 address, your connection to that service used IPv4. Services that answer on both protocols can show both, which tells you whether your ISP provides IPv6. Remember that a VPN, a mobile network or a work proxy can change the answer.
Frequently asked questions
Will IPv4 be switched off?
There is no switch-off date. IPv4 will stay in use for a long time, with transition mechanisms bridging networks that have only one protocol.
Is IPv6 faster?
Not by design. Performance depends on the route, the network operator and congestion. Sometimes IPv6 avoids a layer of carrier-grade NAT and is slightly quicker; sometimes it is not.
Is IPv6 more secure?
IPsec can protect traffic on both versions, and IPv6 has no built-in advantage beyond that. In practice security depends on firewalls, patching and configuration, not on the version number.
Why was IPv5 skipped?
The number 5 was used for an experimental streaming protocol, so the next version for general use was numbered 6.