IPv6 expand & compress
Paste an IPv6 address in any notation. You get the full expanded form for logs and comparisons, and the canonical compressed form for configuration.
- Expanded(full form)
- 2001:0db8:0000:0000:0000:ff00:0042:8329
- Compressed(RFC 5952)
- 2001:db8::ff00:42:8329
- Groups
- 2001 0db8 0000 0000 0000 ff00 0042 8329
The compressed form is canonical: lowercase, leading zeros dropped, and :: over the longest run of zero groups. A single zero group is never collapsed — that would not round-trip.
The two forms
An IPv6 address is 128 bits, written as eight groups of four hex digits. Written in full that is 39 characters, most of them usually zeros, so the notation allows two shortenings: leading zeros in a group may be dropped, and one run of all-zero groups may be replaced by ::.
Both forms name the same address. Use the expanded form when you need to compare or sort addresses as text, and the compressed form everywhere a human reads it.
RFC 5952 in four rules
- Lowercase hex digits —
2001:db8::1, never2001:DB8::1. - No leading zeros within a group —
db8, not0db8. ::replaces the longest run of zero groups, and only when that run is two or more.- On a tie, the leftmost run wins.
These rules exist so that one address has exactly one canonical spelling. Without them, caching, logging and access control that compare addresses as strings all misbehave.
Worth recognising
| Address or prefix | Meaning |
|---|---|
| :: | Unspecified address — all 128 bits zero |
| ::1 | Loopback, the IPv6 equivalent of 127.0.0.1 |
| fe80::/10 | Link-local, valid only on one network segment |
| fc00::/7 | Unique local, the rough equivalent of RFC 1918 |
| 2001:db8::/32 | Reserved for documentation (RFC 3849) |
| ::ffff:0:0/96 | IPv4-mapped, e.g. ::ffff:192.0.2.1 |
| ff00::/8 | Multicast |
| 2000::/3 | Currently allocated global unicast space |
Frequently asked
- Why can :: only appear once in an address?
- The :: stands for however many zero groups are needed to make eight in total. With two of them the split would be ambiguous — 1::2::3 could mean several different addresses — so the notation permits only one.
- Why is a single zero group not compressed to ::?
- RFC 5952 requires :: to replace a run of at least two zero groups. Collapsing a lone zero saves no characters and creates ambiguity, so 1:0:2:3:4:5:6:7 keeps its 0 rather than becoming 1::2:3:4:5:6:7, which would be a different address.
- Which run does :: replace when there are two of equal length?
- The leftmost. In 1:0:0:2:0:0:3:4 both runs are two groups long, so the canonical form is 1::2:0:0:3:4. Implementations that pick the rightmost produce a valid address that is not canonical, which breaks string comparison of log entries.
- Why compare expanded addresses instead of the short form?
- The same address has many valid textual forms, so string-matching short forms gives false negatives. Either expand both sides first, or parse both to bytes and compare those. Expanding is the quick fix when grepping logs.
Doing this for thousands of addresses?
These calculators run in your browser and never send us your input. When you need geolocation, ASN and network data for addresses in bulk, the API answers in one call — no key required to try it.
curl https://api.ipaddresstoday.com/api/v1/8.8.8.8Other free tools
- Subnet calculatorNetwork and broadcast address, subnet mask, wildcard mask, usable host range and host count for any IPv4 block.
- CIDR to IP rangeConvert a CIDR block to its first and last address, or collapse an arbitrary address range into the smallest set of CIDR blocks.
- IP address converterConvert an IPv4 address between dotted-quad, decimal, hexadecimal, binary and octal.