OneWebDesk

IPv6 Compress / Expand

Convert IPv6 addresses between compressed and expanded forms.

An IPv6 address is 128 bits, written as eight groups of 16 bits separated by colons (e.g. 2001:0db8:0000:0000:0000:0000:0000:0001). A compressed form that omits zeros (2001:db8::1) is also common. This converter translates between the two forms, showing both the canonical compressed and the full expanded version no matter how you type it.

When the same address appears in different forms across firewall rules, logs and config files, normalize to the expanded form to compare them reliably. For IPv4 range math, pair this with the CIDR calculator.

Conversion result
Compressed (canonical)2001:db8::1
Expanded (full)2001:0db8:0000:0000:0000:0000:0000:0001

Compression rules

  1. Drop leading zeros in each group: 0db8db8.
  2. Replace only the longest run of all-zero groups with ::. If runs tie, the first one is compressed.

Common IPv6 addresses

  • ::1 — loopback (IPv4 127.0.0.1)
  • :: — unspecified address (all zeros)
  • fe80::/10 — link-local
  • 2001:db8::/32 — documentation range

Expanded ↔ compressed reference table

The same address shown side by side in both forms, following RFC 5952 exactly (lowercase, a single zero group is never shortened to ::, and only the longest zero run is compressed).

Expanded formCompressedNote
2001:0db8:0000:0000:0000:0000:0000:00012001:db8::1Drop leading zeros + collapse zero run
2001:0db8:0000:0000:0001:0000:0000:00012001:db8::1:0:0:1Two zero runs (length 2 + 2). On a tie, the first is compressed
fe80:0000:0000:0000:0202:b3ff:fe1e:8329fe80::202:b3ff:fe1e:8329Link-local + EUI-64
2001:0db8:0000:0001:0000:0000:0000:00012001:db8:0:1::1The length-1 run stays as 0; only the length-3 run collapses
0000:0000:0000:0000:0000:ffff:c000:0201::ffff:192.0.2.1IPv4-mapped — last 32 bits stay dotted

Finding the longest zero run — step by step

Walking through how 2001:0db8:0000:0000:0001:0000:0000:0000 compresses:

  1. Strip leading zeros per group: 2001 db8 0 0 1 0 0 0.
  2. Locate zero runs: a length-2 run at groups 3–4 and a length-3 run at groups 6–8.
  3. The longest run is the length-3 one (at the end). Only it becomes ::2001:db8:0:0:1::.
  4. The earlier length-2 run stays as 0:0 (collapsing both would make the address unrecoverable).

Result: 2001:db8:0:0:1:: (expanded: 2001:0db8:0000:0000:0001:0000:0000:0000).

Common pitfall

  • Shortening a single zero group, e.g. writing 2001:db8:0:1::1 as 2001:db8::1::1 — RFC 5952 forbids using :: for a lone zero group, so keep it as 0 even though it is longer.
  • Using :: twice — 2001::25de::cade is invalid because the number of zero groups is ambiguous.
  • Confusing the address colon with a port — in a URL the address must be bracketed, e.g. [2001:db8::1]:443, so the trailing colon reads as the port.

Frequently asked questions

Why can :: appear only once?
Using it twice makes it ambiguous how many zero groups belong to each position, so the address can't be restored. The standard allows :: once per address.
Are zone identifiers (%eth0) handled?
The zone id after % is ignored; only the address part is converted.
Can I type uppercase?
Yes. RFC 5952 recommends lowercase, so output is normalized to lowercase.
Are IPv4-mapped addresses (::ffff:192.0.2.1) handled?
Yes. A form with the last 32 bits written as dotted IPv4 is recognized and shown in both compressed and expanded forms. Per the standard, the IPv4 part stays in dotted notation.
Is the address I enter sent to a server?
No. All conversion runs entirely in your browser, and the IPv6 address you enter is never transmitted or stored.

Related tools

Network / IP