Networking

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

IPv4IPv6
Address size32 bits128 bits
Number of addresses2³² ≈ 4.3 billion2¹²⁸ ≈ 3.4 × 10³⁸
Written as4 decimal bytes, dots8 groups of 16 bits in hex, colons
Example192.0.2.102001:db8::10
Network size notationmask (255.255.255.0) or /24prefix only, typically /64 for a LAN
Local address resolutionARP broadcastsNeighbor Discovery (ICMPv6 multicast)
Automatic configurationDHCPSLAAC and/or DHCPv6
Headervariable, 20–60 bytes, has a checksumfixed 40 bytes, no header checksum
Fragmentationrouters may fragmentonly the sending host fragments
NATcommon, to stretch addressesnot 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:

  1. Drop leading zeros in each group: 0db8 → db8, 0042 → 42, 0000 → 0.
  2. 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:

Try itPaste any IPv6 address to see its full form and its canonical short form.
Full form (8 × 16 bits)
2001:0db8:0000:0000:0000:ff00:0042:8329
Recommended short form (RFC 5952)
2001:db8::ff00:42:8329
Bits
128
First group in binary
0010000000000001

Worked examples, checked against Python’s ipaddress module:

Full formCanonical short form
2001:0db8:0000:0000:0000:0000:0000:00012001:db8::1
2001:0db8:0000:0001:0000:0000:0000:00012001:db8:0:1::1
2001:0db8:0000:0000:0001:0000:0000:00012001: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

PurposeIPv4IPv6
Loopback127.0.0.1::1
Unspecified0.0.0.0::
Private / local10/8, 172.16/12, 192.168/16fc00::/7 (unique local)
Link-local169.254.0.0/16fe80::/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

  1. RFC 791: Internet Protocol (IPv4) — IETF
  2. RFC 8200: Internet Protocol, Version 6 (IPv6) Specification — IETF
  3. RFC 4291: IP Version 6 Addressing Architecture — IETF
  4. RFC 5952: A Recommendation for IPv6 Address Text Representation — IETF
  5. RFC 4861: Neighbor Discovery for IP version 6 — IETF
  6. 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.

Copied to clipboard!