IPv6 Expand / Compress
Expand and compress IPv6 addresses; detect ULA.
Overview
The IPv6 expand / compress tool toggles between the fully written form of an IPv6 address (2001:0db8:0000:0000:0000:ff00:0042:8329) and its compressed form (2001:db8::ff00:42:8329). Paste either and get the other, plus a side note flagging whether the address falls into a special block — global unicast, unique local, link-local, or multicast.
Network engineers comparing addresses in a firewall log, developers writing IPv6 validation routines, and anyone confused by the :: shorthand all need an IPv6 normaliser. Long-tail keywords covered: expand IPv6 address to full form, compress IPv6 with double colon, and detect ULA from IPv6 prefix.
How it works
IPv6 is 128 bits, written as eight 16-bit groups of hexadecimal separated by colons. Two compression rules apply per RFC 5952: leading zeros within each group are dropped (0042 becomes 42), and the longest run of consecutive zero groups is replaced with :: (used at most once per address). When there are ties, the leftmost run wins. Capitalisation should be lowercase in the canonical form.
The expand operation reverses both rules — every group is padded to four hex digits and the :: shorthand is replaced by the right number of 0000 groups. Detection of ULA, link-local, multicast, and other special blocks is a simple prefix match against the registered IPv6 special-use ranges in RFC 6890.
Examples
2001:db8::1↔2001:0db8:0000:0000:0000:0000:0000:0001.fe80::1(link-local) ↔fe80:0000:0000:0000:0000:0000:0000:0001.::1(loopback) ↔0000:0000:0000:0000:0000:0000:0000:0001.fd00:1234:5678::abcd(ULA) ↔fd00:1234:5678:0000:0000:0000:0000:abcd.
FAQ
Can I use :: twice in one address?
No. RFC 5952 forbids more than one :: because it makes the expansion ambiguous. Some parsers accept it informally, but the canonical form picks the longest run of zeros and uses :: exactly once there.
Why does my address compress to ::1234:0:0:5678 instead of ::5678?
:: must replace the longest run of zeros, not the first one. Where two runs are the same length, the leftmost wins.
Is uppercase or lowercase hex correct?
Both are valid, but RFC 5952 mandates lowercase for the canonical representation. Tools should accept either and emit lowercase.
How do I detect a ULA address?
A ULA falls in fc00::/7. In practice almost all ULAs start with fd (the high bit of the second nibble is set per RFC 4193), so a quick prefix check on fd00::/8 catches everything you will see in the wild.