Why an IPv6 address has two forms
A full IPv6 address is 32 hex digits in eight groups of four, for example 2001:0db8:0000:0000:0000:ff00:0042:8329. That is long to read and easy to mistype, so there is an agreed short form. Computers accept both. Trouble starts when people compare two addresses that are the same but written differently, or when a program expects one particular form. This tool gives both.
The rules for shortening
- Drop leading zeros in each group.
0db8becomesdb8,0042becomes42, and0000becomes0. - Replace one run of all-zero groups with
::. In the example, three zero groups in a row collapse:2001:db8::ff00:42:8329. - Use
::only once. If it appeared twice, nobody could tell how many zero groups each one stood for. - Pick the longest run. If two runs are equally long, shorten the first.
- Do not use
::for a single zero group. Write that group as0. - Use small letters:
2001:db8::1, not2001:DB8::1.
Rules 4 to 6 come from the internet standard on writing IPv6 addresses (RFC 5952), which exists so that everyone produces the same short form for the same address. The tool follows it.
The rule for expanding
Count the groups that are written. There must be eight in all, so :: stands for however many are missing. Then pad every group to four digits with leading zeros. 2001:db8::1 has three groups written, so :: stands for five groups of zeros: 2001:0db8:0000:0000:0000:0000:0000:0001.
What else the tool shows
- Kind of address: global (public), unique local (private), link-local, multicast, loopback, documentation and a few rarer kinds.
- The first 64 bits: in a normal IPv6 network the first half of the address names the network and the second half names the device. The network part is what your provider or router assigned.
Things that trip people up
- Zone names: on your own computer a link-local address may appear as
fe80::1%eth0orfe80::1%12. The part after the percent sign names the network port. It is not part of the address, and the tool ignores it. - Square brackets: in a web address an IPv6 address is wrapped in brackets so the colons are not mistaken for a port:
http://[2001:db8::1]:8080/. The tool accepts the brackets. - IPv4 at the end: forms such as
::ffff:192.168.1.1are valid. The last two groups are written as an IPv4 address. - Letters beyond f: hex has only 0 to 9 and a to f. A "g" or an "o" means a typing slip.
Try these
Paste fe80:0000:0000:0000:0202:b3ff:fe1e:8329, ::1, 2001:db8:0:0:1:0:0:1 and ff02::1 to see different kinds and how the longest run is chosen.
Is the short form or the full form the "real" address?
Both are the same 128-bit number. Use the short form when writing for people, and the full form when a system needs fixed-width text or you want to sort or compare addresses.
Why does my device show several IPv6 addresses?
That is normal. A device has a link-local address, usually a stable public one, and often temporary public ones that change every day or so for privacy.
Can two different short forms mean the same address?
Yes, if someone ignores the standard: 2001:db8:0:0:1::1 and 2001:db8::1:0:0:1 are the same address. Only the second follows the rules.