๐Ÿฆ IP Animals
๐ŸŒ IPv6 Tools

IPv6 Expand & Compress Tool

Expand an IPv6 address to its full 8-group form or compress it to the shortest valid form per RFC 5952. Handles the :: shorthand and embedded IPv4 โ€” entirely in your browser.

Any valid form, e.g. 2001:db8::1 or ::ffff:192.0.2.1.

Two ways to write the same address

An IPv6 address is 128 bits, written as eight groups (hextets) of four hexadecimal digits separated by colons. To keep them readable, the standard allows two shortcuts: dropping the leading zeros inside each group, and collapsing one run of all-zero groups to a double colon (::). The expanded form spells everything out; the compressed form is as short as the rules allow. Both refer to the exact same address โ€” this tool converts freely between them.

Expanding 2001:db8::1 restores every group to four digits and fills the :: with the right number of zero groups, giving 2001:0db8:0000:0000:0000:0000:0000:0001. Compressing that back applies RFC 5952: lowercase hex, strip leading zeros, and replace the single longest run of zero groups with :: โ€” producing the canonical 2001:db8::1 once more.

๐Ÿ”ฌ The RFC 5952 canonical rules

Use lowercase aโ€“f. Remove leading zeros in every group (but keep a lone 0). Compress the longest run of consecutive zero groups, and only a run of two or more. The :: may appear at most once; on a tie for longest, compress the first run. A single zero group is never shortened to ::.

The tool also understands embedded IPv4. An address such as ::ffff:192.0.2.1 โ€” the form used for IPv4-mapped addresses โ€” is parsed by converting the trailing dotted-quad into two hextets, so it expands to 0000:0000:0000:0000:0000:ffff:c000:0201. Every input is validated: more than one ::, non-hex characters, or too many groups are rejected with a clear message.

New to the longer address family? Our overview of IPv4 vs IPv6 explains why IPv6 exists and how its notation works, while what is an IP address covers the basics. For random test data, try the Random IP Generator, or check IPv4 membership with the IP in Subnet Checker. Everything runs locally โ€” nothing is uploaded.

Frequently asked questions

How do I expand an IPv6 address?

Restore every group to four hex digits and replace the :: shorthand with the exact number of zero groups it stands for, so all eight groups are present. For example 2001:db8::1 expands to 2001:0db8:0000:0000:0000:0000:0000:0001. This tool does it instantly and validates the input.

What are the RFC 5952 compression rules?

RFC 5952 requires lowercase hex, leading zeros stripped from each group, and the single longest run of consecutive all-zero groups replaced by a double colon. The :: may appear only once, and if there is a tie for the longest run, the first one is compressed. That turns 2001:0db8:0000:0000:0000:0000:0000:0001 back into 2001:db8::1.

Does it handle embedded IPv4 like ::ffff:192.0.2.1?

Yes. A trailing dotted-quad such as ::ffff:192.0.2.1 is parsed and converted into its two hextets, so it expands to 0000:0000:0000:0000:0000:ffff:c000:0201. The tool validates each octet is within 0 to 255.

Why can the double colon only appear once?

The :: stands for one run of one or more all-zero groups. If it appeared twice the address would be ambiguous, because you could not tell how many zero groups belong to each ::. That is why both this tool and the standard reject addresses containing more than one double colon.

Want the theory? Read the guides โ†’ ยท Visit the zoo โ†’