What this tool does
IPv6 addresses can be written many ways for the same value. This tool converts between the two endpoints of that range: the fully expanded 128-bit form and the canonical compressed form defined by RFC 5952. It also validates the address, rejecting anything that does not follow the standard notation rules.
How it works
An IPv6 address is eight 16-bit groups written as hex separated by colons. The :: shorthand stands for one or more consecutive groups of zeros and may appear at most once.
To expand: the tool splits the address on ::, counts the groups on each side, and inserts exactly enough zero groups in the middle to reach eight. Then it pads every group to four hex digits: 2001:db8::1 becomes 2001:0db8:0000:0000:0000:0000:0000:0001.
To compress per RFC 5952: the tool scans the eight groups for the longest run of consecutive all-zero groups (at least two groups long), replaces that run with ::, and strips leading zeros from each remaining group. If two runs tie for longest, the leftmost run is collapsed. Single zero groups are left as a literal 0 rather than collapsed, because :: must replace at least two groups to be worthwhile.
Why :: can appear only once
If :: appeared twice in an address, the address would be ambiguous: there would be no way to determine how many zero groups each :: represents while still totaling to eight groups. The tool rejects any address that contains more than one ::.
Worked examples
| Input | Expanded form | Canonical compressed |
|---|---|---|
2001:db8::1 | 2001:0db8:0000:0000:0000:0000:0000:0001 | 2001:db8::1 |
0:0:0:0:0:0:0:1 | 0000:0000:0000:0000:0000:0000:0000:0001 | ::1 (loopback) |
0:0:0:0:0:0:0:0 | 0000:0000:0000:0000:0000:0000:0000:0000 | :: (unspecified) |
2001:0db8:0000:0000:0001:0000:0000:0001 | (already full) | 2001:db8::1:0:0:1 |
fe80::1 | fe80:0000:0000:0000:0000:0000:0000:0001 | fe80::1 |
Why you need both forms
Expanded form is most readable for humans stepping through an address field by field and is required by some strict parsers or database column formats that store exactly 39 characters.
Canonical compressed form (RFC 5952) is required when comparing addresses for equality — two addresses can represent the same value written differently. Normalizing to canonical form first means a straightforward string comparison works. It is also the form used by modern operating systems (ip addr output on Linux, ipconfig on Windows) and many firewall configuration interfaces.
Deduplication: if you have a list of IPv6 addresses from different sources (logs, APIs, user input), compressing them all to canonical form lets you deduplicate reliably without needing a specialized parser for each variant.
Notes
This tool works with pure hexadecimal IPv6 notation. Dual-stack addresses with a trailing IPv4 literal (like ::ffff:192.0.2.1) require converting the IPv4 portion to two hex groups before pasting. All conversion runs in your browser; no addresses are uploaded.