ShareYourGroupShareYourGroupIP and Internet

IPv6 address: expand and shorten

Paste an IPv6 address in any form. You get the full form, the standard short form and the kind of address.

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

  1. Drop leading zeros in each group. 0db8 becomes db8, 0042 becomes 42, and 0000 becomes 0.
  2. Replace one run of all-zero groups with ::. In the example, three zero groups in a row collapse: 2001:db8::ff00:42:8329.
  3. Use :: only once. If it appeared twice, nobody could tell how many zero groups each one stood for.
  4. Pick the longest run. If two runs are equally long, shorten the first.
  5. Do not use :: for a single zero group. Write that group as 0.
  6. Use small letters: 2001:db8::1, not 2001: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

Things that trip people up

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.