IPv4 vs. IPv6 With Address Examples
IPv4 uses 32-bit addresses like 192.0.2.10; IPv6 uses 128-bit ones like 2001:db8::1. Formats, shortening rules, header differences and a live expander.
IPv4 addresses are 32 bits, written as four decimal numbers: 192.0.2.10. That allows about 4.3 billion addresses, which the internet outgrew. IPv6 addresses are 128 bits, written as eight groups of four hex digits: 2001:0db8:0000:0000:0000:ff00:0042:8329, usually shortened to 2001:db8::ff00:42:8329. The two protocols run side by side; most devices today have both.
Side-by-side comparison
| IPv4 | IPv6 | |
|---|---|---|
| Address size | 32 bits | 128 bits |
| Number of addresses | 2³² ≈ 4.3 billion | 2¹²⁸ ≈ 3.4 × 10³⁸ |
| Written as | 4 decimal bytes, dots | 8 groups of 16 bits in hex, colons |
| Example | 192.0.2.10 | 2001:db8::10 |
| Network size notation | mask (255.255.255.0) or /24 | prefix only, typically /64 for a LAN |
| Local address resolution | ARP broadcasts | Neighbor Discovery (ICMPv6 multicast) |
| Automatic configuration | DHCP | SLAAC and/or DHCPv6 |
| Header | variable, 20–60 bytes, has a checksum | fixed 40 bytes, no header checksum |
| Fragmentation | routers may fragment | only the sending host fragments |
| NAT | common, to stretch addresses | not needed for address shortage |
The addresses on this page come from blocks reserved for documentation: 192.0.2.0/24 for IPv4 and 2001:db8::/32 for IPv6.
Reading an IPv4 address
Each of the four numbers is one byte, 0–255. In binary, 192.0.2.10 is 11000000.00000000.00000010.00001010. A subnet mask such as /24 splits the 32 bits into network and host parts; the subnet mask guide lets you slide that boundary.
Reading an IPv6 address
An IPv6 address is eight 16-bit groups. Two rules make it shorter, and RFC 5952 fixes one canonical way to apply them:
- Drop leading zeros in each group:
0db8→db8,0042→42,0000→0. - Replace the longest run of all-zero groups with
::, once per address. If two runs tie, compress the first. A single zero group is not compressed.
Try it with your own addresses:
- Full form (8 × 16 bits)
- Recommended short form (RFC 5952)
- Bits
- First group in binary
Worked examples, checked against Python’s ipaddress module:
| Full form | Canonical short form |
|---|---|
| 2001:0db8:0000:0000:0000:0000:0000:0001 | 2001:db8::1 |
| 2001:0db8:0000:0001:0000:0000:0000:0001 | 2001:db8:0:1::1 |
| 2001:0db8:0000:0000:0001:0000:0000:0001 | 2001:db8::1:0:0:1 |
| 0000:0000:0000:0000:0000:0000:0000:0001 | ::1 (loopback) |
In a typical address the first 64 bits are the network prefix and the last 64 the interface identifier. Link-local addresses start with fe80:: and exist on every IPv6-enabled interface, even without a router.
Why IPv6 exists and why IPv4 is still everywhere
Regional registries ran out of fresh IPv4 blocks in the 2010s. Network address translation (NAT) let many devices share one public IPv4 address, which postponed the problem but complicates direct connections. IPv6 gives every device globally unique addresses again.
The protocols are not compatible on the wire, so networks run dual stack: devices get both an IPv4 and an IPv6 address, and applications try IPv6 first and fall back quickly if it fails. Google publishes a live chart of the share of its users who connect over IPv6.
Equivalent addresses to know
| Purpose | IPv4 | IPv6 |
|---|---|---|
| Loopback | 127.0.0.1 | ::1 |
| Unspecified | 0.0.0.0 | :: |
| Private / local | 10/8, 172.16/12, 192.168/16 | fc00::/7 (unique local) |
| Link-local | 169.254.0.0/16 | fe80::/10 |
A program listening only on 127.0.0.1 is unreachable at ::1, even though both mean “this machine”. That mismatch causes real connection errors, reproduced in the ERR_CONNECTION_REFUSED guide.
Sources
- RFC 791: Internet Protocol (IPv4) — IETF
- RFC 8200: Internet Protocol, Version 6 (IPv6) Specification — IETF
- RFC 4291: IP Version 6 Addressing Architecture — IETF
- RFC 5952: A Recommendation for IPv6 Address Text Representation — IETF
- RFC 4861: Neighbor Discovery for IP version 6 — IETF
- IPv6 adoption statistics — Google. live share of users reaching Google over IPv6
How we made this
Computed and checked by tests. The IPv6 expander/compressor (src/lib/calc/ipv6.js) implements RFC 4291 parsing and RFC 5952 canonical form; its outputs were compared against Python's ipaddress module for the examples on this page.
Performed by Claude, an AI assistant working in the BinConvert repository (Node.js 25, Python 3.14.3), November 16, 2026.
This article was drafted with AI assistance. Every example, calculation and command output on this page was re-run or checked before release; compressed forms were cross-checked with Python's ipaddress module. Review: automated test suite and source check, November 16, 2026.
Spotted an error? Tell us and we will correct it.