IPv6 Address Compressor & Expander

Normalise IPv6 addresses to the RFC 5952 canonical text form, expand them to eight full groups, and see the binary and hex-group forms side by side. One address per line.

Input

Mode

Any RFC 4291 spelling, optionally with a /prefix or a %zone id.

Canonical form (RFC 5952)

Compressed
2001:db8::1
Fully expanded
2001:0db8:0000:0000:0000:0000:0000:0001
Hex groups
2001:0db8:0000:0000:0000:0000:0000:0001
128-bit integer
42540766411282592856903984951653826561

Exact — a double cannot hold this value

Input was not in canonical form

Binary

128 bits, grouped by hextet

0010000000000001 0000110110111000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000001

Each group is one 16-bit hextet. Reading left to right gives the eight groups above, which is why the compressed form can only ever drop runs of 0000.

What the canonical rules did

RFC 5952 §4

  • Lower case only — 2001:0DB8::1 becomes 2001:db8::1.
  • No leading zeros in a group — 0db8 becomes db8.
  • :: is used only for the longest run of two or more zero groups; on a tie the leftmost run wins.
  • A single zero group is never compressed, so 2001:db8:0:1:1:1:1:1 keeps its 0.

Frequently asked

What makes an IPv6 address canonical?
RFC 5952 requires lower case, no leading zeros inside a group, and a single :: for the longest run of two or more all-zero groups. Where two runs are the same length, the leftmost one is compressed. An address written 2001:0DB8:0000:0000:0000:0000:0000:0001 is not canonical; 2001:db8::1 is.
When is :: not used?
A single zero group is never compressed, so 2001:db8:0:1:1:1:1:1 stays exactly as written. RFC 5952 §4.2.2 is explicit about this because :: for one group invites miscounting.
Does the tool change the address?
No. Compressed and expanded forms are two spellings of the same 128-bit value. The page flags lines that were not already canonical so you can tell which input needed rewriting.
How do I check a whole file of addresses?
Switch to bulk mode and paste one address per line. Blank lines and lines starting with #, ! or // are ignored, invalid lines are listed separately, and the results export to CSV, Markdown or JSON.

Next