Quiz Entry - updated: 2026.07.05
What are the canonical IPv6 text-representation rules from RFC 5952?
Lowercase hex, drop leading zeros in each group, collapse the longest zero-run to ::, and use :: only once (leftmost on a tie).
RFC 5952 exists because the same address can be written many valid ways — which breaks string comparison, logs, and ACLs. The binding rules produce one canonical form:
- Lowercase all hex letters (
a–f, neverA–F) - Omit leading zeros in every group (
0db8→db8,0000→0) - Collapse one or more consecutive all-zero groups to
:: ::must shorten the longest run of zero groups; on a tie, compress the leftmost run::is never used to shorten just a single0group when it wouldn't save space
So 2001:0DB8:0000:0000:0001:0000:0000:0001 canonicalises to 2001:db8::1:0:0:1 — there are two equal-length zero runs (groups 3–4 and groups 6–7), so the tie-break rule kicks in and the left run is the one compressed.
Tip: When two equal-length zero runs exist, compress the left one — a common exam trap.
Go deeper:
RFC 5952 — A Recommendation for IPv6 Address Text Representation — the primary spec; Section 4 lists each canonicalisation rule with rationale.