IPv6 Expand and Compress (RFC 5952)
Expand, compress and validate IPv6 addresses and prefixes.
Use via API
Validate an IPv6 address and return its expanded and compressed forms, address type, reverse DNS name, embedded IPv4, integer value and, with a prefix, the network range. Send JSON, get JSON back.
POST https://pithlab.com/api/v1/tools/ipv6-address-tool
curl https://pithlab.com/api/v1/tools/ipv6-address-tool \
-H "Authorization: Bearer $PITHLAB_KEY" \
-H "Content-Type: application/json" \
-d '{"address":"2001:db8:0:0:8:800:200c:417a/64"}'About the IPv6 Expand and Compress
Expand or compress IPv6 addresses to RFC 5952 form, validate them, find the address type and prefix range, and get the ip6.arpa reverse DNS name.
How to use the IPv6 Expand and Compress
- Paste one IPv6 address per line. You can include a prefix such as /64, a zone ID such as %eth0, or an embedded IPv4 part.
- Each line shows the compressed RFC 5952 form, the full expanded form, the address type and the reverse DNS name.
- If you add a prefix, the first and last address of that network and its size are shown too.
- Copy any single value, or copy all compressed or expanded results at once.
Examples
Input
2001:0DB8:0000:0000:0000:ff00:0042:8329
Output
Compressed: 2001:db8::ff00:42:8329 Expanded: 2001:0db8:0000:0000:0000:ff00:0042:8329 Type: Documentation (RFC 3849)
Input
2001:db8:85a3::8a2e:370:7334/64
Output
Compressed: 2001:db8:85a3::8a2e:370:7334/64 Expanded: 2001:0db8:85a3:0000:0000:8a2e:0370:7334 Type: Documentation (RFC 3849) Network: 2001:db8:85a3::/64 First: 2001:db8:85a3:: Last: 2001:db8:85a3:0:ffff:ffff:ffff:ffff Addresses: 18,446,744,073,709,551,616
Input
::ffff:192.0.2.1
Output
Compressed: ::ffff:192.0.2.1 Expanded: 0000:0000:0000:0000:0000:ffff:c000:0201 Type: IPv4-mapped IPv4: 192.0.2.1
Input
fe80::1%eth0
Output
Compressed: fe80::1%eth0 Expanded: fe80:0000:0000:0000:0000:0000:0000:0001 Type: Link-local unicast Zone: eth0
Frequently asked questions
What are the RFC 5952 compression rules?
Use lowercase hex, drop leading zeros in each group, and replace the longest run of two or more all-zero groups with ::. If two runs are equally long, the first one is compressed. A single zero group is written as 0, never ::.
Why does 2001:db8:0:0:1:0:0:1 become 2001:db8::1:0:0:1?
There are two runs of two zero groups. RFC 5952 says to compress the leftmost when runs tie, so the first pair becomes :: and the second stays as 0:0.
What is a zone ID?
Link-local addresses such as fe80::1 exist on every interface, so a zone ID like %eth0 or %3 says which interface is meant. It is kept in the compressed output but is not part of the address bits.
How is the reverse DNS name built?
The address is expanded to 32 hex digits, the digits are reversed, separated by dots and followed by ip6.arpa. That is the name a PTR record for the address lives under.
Which address types are recognised?
Unspecified, loopback, IPv4-mapped, NAT64, discard-only, documentation (2001:db8::/32 and 3fff::/20), Teredo, 6to4, unique local (fc00::/7), link-local, deprecated site-local, multicast with its scope, and global unicast.