All posts

IPv6 Addressing Explained: Expanding and Compressing Addresses

July 9, 2026 · DevTools

networking
ipv6
guide

An IPv6 address is 128 bits, written as eight groups of four hexadecimal digits separated by colons. That's a lot to type, so the format allows two shortcuts — which is exactly why the same address can look like several different strings.

The two shorthand rules

1. Drop leading zeros in each group. 0db8 becomes db8, 0000 becomes 0.

2. Collapse one run of all-zero groups to ::. The double colon can appear at most once in an address, because more than one would be ambiguous.

So this full address:

2001:0db8:0000:0000:0000:0000:0000:0001

compresses to:

2001:db8::1

Both are the same address. The trouble starts when you need to compare two addresses, store a canonical value in a database, or paste one into a system that insists on the full form.

RFC 5952: the canonical form

RFC 5952 defines the single "correct" way to write an address so everyone agrees:

  • Lowercase hex letters.
  • Omit leading zeros.
  • Compress the longest run of zero groups (and if two runs tie, the first one).
  • Don't use :: to collapse a single zero group — write :0:.

Following these rules deterministically means the same address always produces the same string.

Embedded IPv4

You'll sometimes see addresses like ::ffff:192.168.0.1 — an IPv4-mapped IPv6 address. The trailing dotted-decimal part is just a human-friendly way of writing the last two hex groups (c0a8:0001).

Normalize it instantly

The IPv6 Address Expander takes any valid form, validates it, expands it to the full eight-group representation, and re-compresses it to the canonical RFC 5952 form — including IPv4-mapped addresses. For planning networks and prefixes, pair it with the Subnet Calculator.

Tools mentioned in this post