b2KIT

IPv6 Address Expander / Compressor

Expand shortened IPv6 addresses to full form and compress verbose addresses. Validate and analyze IPv6 notation.

Tested tool guide Tested browser tools Checked August 16, 2026

What IPv6 Address Expander / Compressor does, with a checked example

The double colon in an IPv6 literal is compact but easy to miscount. This tool accepts an IPv6 address, checks its textual notation, and shows the same 128-bit value in fully expanded and compressed forms. Expansion restores four hexadecimal digits per group and fills groups omitted by ::. Compression removes unnecessary leading zeros and shortens a zero run. The common surprise is that :: does not mean exactly one group; it supplies however many all-zero 16-bit groups are needed to make eight. Processing stays in the browser, so pasted addresses are not uploaded.

Worked example

A concrete input and expected output from the current implementation.

Input

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

Expected output

Expanded: 2001:0db8:0000:0000:0000:0000:0000:0001
Compressed: 2001:db8::1

The expanded input already contains eight four-digit groups. Compression removes leading zeros from 0db8 and 0001, then replaces the five consecutive 0000 groups with ::.

How the result is produced

1

Expanding omitted groups

An IPv6 address consists of eight 16-bit hexadecimal groups. During expansion, each written hexadecimal group is padded on the left to four digits. When :: appears, the groups on each side are counted and enough 0000 groups are inserted to produce eight total groups. The notation can contain :: only once, because two omissions would leave the group counts ambiguous.

2

Compressing and validating

Compression preserves the 128-bit value. It removes leading zeros within groups and replaces a consecutive run of all-zero groups with ::. For canonical text, RFC 5952 recommends lowercase digits, the longest zero run, the first run when lengths tie, and no compression of a single zero group. Validation catches malformed hexadecimal groups, impossible group counts, and repeated :: notation.

Good uses

  • Expand an address from a log entry before aligning all eight 16-bit fields with a packet capture, firewall rule, or address plan.
  • Compress a fully padded address copied from an appliance export so it can be entered using the conventional shorter IPv6 spelling.
  • Normalize candidate duplicates in an incident report when one system records uppercase padded groups and another records lowercase compressed notation.

Limits and checks

  • A syntactically valid result does not establish that the address is assigned, reachable, trusted, publicly routed, or associated with a particular device.
  • Compression is not anonymization. Expanded and compressed forms contain the same 128-bit address, so shortening a sensitive address does not conceal its identity.
  • Canonical and valid are different concepts. An IPv6 spelling can be valid without following RFC 5952's preferred compression and lowercase conventions.

Common questions

How many groups does :: represent?

It depends on the rest of the address. Count the explicit groups and subtract that number from eight; the result must be at least one because :: cannot represent zero groups. In 2001:db8::1, three groups are written, so :: represents five 0000 groups. In ::1, one group is written, so it represents seven. If :: does not replace at least one group, or the notation cannot expand to exactly eight groups, it is invalid.

Can two different IPv6 strings represent the same address?

Yes. 2001:db8::1 and 2001:0db8:0000:0000:0000:0000:0000:0001 contain the same 128 bits. Omitted leading zeros, hexadecimal letter case, and one compressed zero run change only the textual representation. Expand both values, or compare their normalized compressed forms, before treating differently written addresses as distinct.

References and verification

The example and behavioral notes were checked against the browser implementation. Standards and primary references below define the relevant format, formula, or platform behavior.

Related Tools