2001:0db8:0000:0000:0000:0000:0000:0001 becomes 2001:db8::1.
How to compress an address
Paste or type an IPv6 address into the field. It can be the full form or a partly shortened one. Click Calculate. Copy the short form from the Result row.
/64 and without square brackets. Anything that is not a valid IPv6 address, an IPv4 address included, gets the message "Enter a valid IPv6 address."
How to read the result
How an IPv6 address is written
The two shortening rules
0db8 becomes db8, 0001 becomes 1, and a group of four zeros becomes a single 0. Only zeros at the front of a group go. db80 keeps its last zero, because removing it would change the value.
::. The double colon means "as many zero groups as it takes to make eight". In 2001:db8:0:0:0:0:0:1, five zero groups in a row collapse and leave 2001:db8::1.
2001:db8::1::2 could mean several different addresses, so it is not valid.
When an address has more than one run of zero groups, the longest run is replaced. When two runs are equally long, the first one is replaced. A single zero group on its own is written as 0, not as a double colon.The letters a to f are written in lowercase.
How to compress an address by hand
Write the address with all eight groups, if it is not already in that form. Remove the leading zeros of every group. A group of four zeros becomes 0.Mark every run of two or more 0groups that stand next to each other.Replace the longest run with a double colon. If two runs tie, take the one on the left. Change any capital letters to lowercase.
2001:0DB8:0000:0000:0012:0000:0000:0034, the second step gives 2001:DB8:0:0:12:0:0:34. There are two runs of two zero groups, so the left one is replaced: 2001:DB8::12:0:0:34. Lowercase letters finish it: 2001:db8::12:0:0:34.
Worked examples
| Full form | Compressed | What happened |
|---|---|---|
2001:0db8:0000:0000:0000:0000:0000:0001 | 2001:db8::1 | |
2001:0db8:85a3:0000:0000:8a2e:0370:7334 | 2001:db8:85a3::8a2e:370:7334 | 0370 shortened to 370 |
2001:0db8:0000:0001:0000:0000:0000:0001 | 2001:db8:0:1::1 | 0 |
2001:0db8:0000:0000:0001:0000:0000:0001 | 2001:db8::1:0:0:1 | |
2001:0DB8:00A0:0000:0001:0002:0003:0004 | 2001:db8:a0:0:1:2:3:4 | |
fe80:0000:0000:0000:0202:b3ff:fe1e:8329 | fe80::202:b3ff:fe1e:8329 | |
2001:0db8:0000:0000:0000:0000:0000:0000 | 2001:db8:: |
2001:db8:0:1:0:0:0:1. There are two runs of zero groups: one group in third position, and three groups in positions five to seven. The longer run becomes the double colon, which leaves 2001:db8:0:1::1.
Common mistakes when shortening by hand
Dropping zeros from the end of a group. 2001:db80::1and2001:db8::1are different addresses.Using the double colon twice, once for each run of zeros. The result is not a valid address, and the tool answers with the error message. Replacing the shorter run. 2001:db8::1:0:0:0:1is a valid address, but its standard spelling is2001:db8:0:1::1. The tool accepts the first and returns the second.Losing or gaining a group while counting. An address with nine groups, or with seven groups and no double colon, is rejected.
Why one standard short form matters
2001:db8::1, 2001:DB8:0:0:0:0:0:1 and 2001:0db8::0001 are all valid and all mean the same thing. A person can see that they match. A text search treats them as three different strings.
Special addresses that are mostly zeros
| Compressed | Full form | Meaning |
|---|---|---|
::1 | 0000:0000:0000:0000:0000:0000:0000:0001 | 127.0.0.1 |
:: | 0000:0000:0000:0000:0000:0000:0000:0000 | |
fe80::1 | fe80:0000:0000:0000:0000:0000:0000:0001 | |
ff02::1 | ff02:0000:0000:0000:0000:0000:0000:0001 | |
2001:db8:: | 2001:0db8:0000:0000:0000:0000:0000:0000 |
:: the double colon stands for all eight groups, and in ::1 for the first seven. An address cannot get much shorter than that, and both are valid input here.
Where a compressed address helps
Comparing the AAAA record that DNS Lookup returns for a domain with the address configured on the server, when the two were written by different people or programs. Cleaning a list of addresses before removing duplicates. Checking an address you shortened by hand. If your version and the Result row differ, the Result row has the standard spelling. If the tool reports an error, the hand-written version was not valid. Preparing an address for documentation, a ticket or a configuration file, where the short form is easier to read and less likely to be mistyped.
What the compressor does not do
2001:db8::/32 has to be entered without the /32. IPv4 addresses are not accepted.