ShareYourGroupShareYourGroupSubnet and Ports

IPv6 address format and how to shorten an address (RFC 5952)

An IPv6 address looks long, but only a few rules explain every shortened form.

The basic form

An IPv6 address is 128 bits, written as eight groups of four hexadecimal digits separated by colons: 2001:0db8:0000:0000:0000:ff00:0042:8329. Each group is 16 bits.

Rule 1: leave out leading zeros in a group

0db8 becomes db8 and 0042 becomes 42. A group of only zeros becomes a single 0: 2001:db8:0:0:0:ff00:42:8329.

Rule 2: replace a run of zero groups with ::

One or more consecutive groups of zeros can be replaced by a double colon: 2001:db8::ff00:42:8329. The double colon can be used only once in an address, because otherwise one could not tell how many groups each stands for.

RFC 5952 recommends one standard way so that addresses can be compared and searched as text:

  1. Leave out leading zeros.
  2. Use :: for the longest run of two or more zero groups. If two runs are equally long, shorten the first.
  3. Do not use :: for a single zero group (write 1:2:3:4:5:6:0:8).
  4. Use lower case letters.

The tool on this site uses these rules. We checked the output against Python's ipaddress module on 400 random addresses and all the short forms matched.

Examples

FullShortest form
2001:0db8:0000:0000:0000:ff00:0042:83292001:db8::ff00:42:8329
0000:0000:0000:0000:0000:0000:0000:0001::1
0000:0000:0000:0000:0000:0000:0000:0000::
fe80:0000:0000:0000:01ff:fe23:4567:890afe80::1ff:fe23:4567:890a
2001:0db8:0001:0000:0000:0000:0000:00012001:db8:1::1

IPv4 inside IPv6

The last 32 bits can be written as an IPv4 address: ::ffff:192.0.2.1 is an IPv4-mapped address. The tool understands this form.

Prefixes

A prefix is written like in IPv4: 2001:db8:abcd::/48 means that the first 48 bits are the network. In URLs, an IPv6 address goes in square brackets: http://[2001:db8::1]:8080/.

Common mistakes

  1. Two :: in one address.
  2. Removing zeros at the end of a group (db80 is not db8).
  3. Comparing addresses as text without putting them in the same form.
  4. Forgetting the brackets in a URL with a port.
Why can't I use :: twice?

With two double colons you could not work out how many zero groups each one stands for.

Is upper or lower case correct?

Both are legal, but RFC 5952 recommends lower case for the standard form.

Sources

  • RFC 4291, IP Version 6 Addressing Architecture; RFC 5952, A Recommendation for IPv6 Address Text Representation (read 14 November 2026)

This is an independent guide. It is not connected with IANA, the IETF or any network equipment maker. Address and port data come from the IANA registries as fetched on 14 November 2026; RFC texts were read from rfc-editor.org. Check the originals for anything you rely on.