Home › Developer Tools › IPv6 Expander & Compressor

IPv6 Expander & Compressor

Paste one IPv6 address or a whole list. Each one is validated, expanded to all eight 4-digit groups and compressed to the canonical RFC 5952 form, with zone IDs, prefix lengths and embedded IPv4 addresses kept intact.

InputStatusCompressed (RFC 5952)ExpandedType

Address details

Advertisement
Advertisement

How to use the IPv6 Expander & Compressor

  1. Paste IPv6 addresses, one per line. Brackets, ports, zone IDs and /prefix lengths are accepted.
  2. Press Compress All for the shortest canonical form or Expand All for the full 39-character form.
  3. Check the table for each address's validity, both forms, its type and reverse DNS name.
  4. Choose the IPv4 option to write IPv4-mapped and NAT64 addresses with a dotted IPv4 tail, as RFC 5952 recommends.
  5. Copy or download the converted list or the full table as CSV.

RFC 5952 compression rules

  1. Drop leading zeros in every group: 0db8 → db8, 0000 → 0.
  2. Use :: for the longest run of two or more consecutive zero groups.
  3. If two runs tie, shorten the first one.
  4. Never use :: for a single zero group.
  5. Write hex letters in lowercase.
Full formCanonical compressed formRule
2001:0db8:0000:0000:0000:ff00:0042:83292001:db8::ff00:42:8329leading zeros + longest run
2001:0db8:0000:0000:0001:0000:0000:00012001:db8::1:0:0:1tie: first run wins
2001:0000:0000:0001:0000:0000:0000:00012001:0:0:1::1longest run wins
2001:0db8:0000:0001:0001:0001:0001:00012001:db8:0:1:1:1:1:1single zero group stays
0000:0000:0000:0000:0000:0000:0000:0001::1loopback
0000:0000:0000:0000:0000:0000:0000:0000::unspecified address
2001:0DB8:0000:0000:0000:0000:0000:000A2001:db8::alowercase
0000:0000:0000:0000:0000:ffff:c000:0280::ffff:192.0.2.128IPv4-mapped, dotted tail (§5)

How expansion works

An IPv6 address is 128 bits written as eight 16-bit groups. To expand fe80::1:2: there are 3 written groups (fe80, 1, 2), so :: stands for 8 − 3 = 5 zero groups. Padding each group to four digits gives fe80:0000:0000:0000:0000:0000:0001:0002. The full form is always 39 characters (32 hex digits and 7 colons), which makes it handy for sorting, database keys and string comparison.

With an embedded IPv4 tail the last two groups come from the four IPv4 octets: 192.0.2.128 → (192 × 256 + 0) = 0xc000 and (2 × 256 + 128) = 0x0280.

Special IPv6 address ranges

PrefixType
::/128, ::1/128Unspecified, loopback
::ffff:0:0/96IPv4-mapped addresses
64:ff9b::/96NAT64 IPv4/IPv6 translation
2000::/3Global unicast (the public internet)
2001::/32, 2002::/16Teredo, 6to4 transition
2001:db8::/32Documentation and examples
fc00::/7Unique local addresses (private, like RFC 1918)
fe80::/10Link-local (needs a zone ID such as %eth0)
ff00::/8Multicast (ff02:: = link-local scope)

Writing IPv6 in URLs and with ports

Because colons separate the groups, an IPv6 address in a URL must be in square brackets: https://[2001:db8::a]:8443/. A zone ID in a URL is written as %25 (RFC 6874), for example http://[fe80::1%25eth0]/. The tool accepts both forms and strips the brackets and port before converting.

Frequently asked questions

How do you compress an IPv6 address?

RFC 5952 defines one canonical form: write hex digits in lowercase, drop leading zeros in every group, and replace the longest run of two or more all-zero groups with ::. If two runs are equally long, the first one is shortened. A single zero group stays as 0.

How do you expand an IPv6 address?

Replace :: with as many 0000 groups as needed to make eight groups in total, then pad every group to four hex digits. 2001:db8::1 becomes 2001:0db8:0000:0000:0000:0000:0000:0001.

Why is 2001:db8:0:1:1:1:1:1 not shortened?

The :: shorthand must not be used for a single 16-bit zero group (RFC 5952, section 4.2.2), so the canonical form keeps the 0. Some older tools still write 2001:db8::1:1:1:1:1, which is valid but not canonical.

What is a zone ID like %eth0?

Link-local addresses (fe80::/10) exist on every interface, so a zone ID after % tells the operating system which interface to use, for example fe80::1%eth0 or fe80::1%3 on Windows. The tool keeps the zone ID unchanged in both forms.

Can I use IPv4 notation inside IPv6?

Yes. The last 32 bits may be written as a dotted IPv4 address, as in ::ffff:192.0.2.128 (IPv4-mapped) or 64:ff9b::198.51.100.7 (NAT64). The expanded form always shows pure hex: 0000:0000:0000:0000:0000:ffff:c000:0280.

Which addresses are rejected?

Addresses with more than one ::, more or fewer than eight groups, groups longer than four hex digits, non-hex characters, an invalid embedded IPv4 part, an empty zone ID or a prefix length above 128. The table explains the exact problem.

Is my data sent anywhere?

No. Validation and conversion run entirely in your browser.

Related tools