VMware ESXi and vSphere Cluster Management

IPv6 Address Format and Address Shortening

Learn IPv6 address structure, hexadecimal notation, leading-zero suppression, double-colon compression, expansion, and common validation mistakes.

IPv6 (Internet Protocol version 6) uses 128-bit addresses. To read and write IPv6 addresses correctly, you need to understand hexadecimal notation, 16-bit groups called hextets, and two shortening rules: leading-zero suppression and zero compression.

IPv6 Address Size

An IPv6 address contains 128 bits. A bit is a binary digit with a value of 0 or 1. By comparison, an IPv4 address contains 32 bits.

The 128 bits are divided into eight equal groups. Each group contains 16 bits, so an IPv6 address has eight 16-bit groups. A 16-bit colon-separated group is commonly called a hextet.

PropertyIPv4IPv6
Address length in bits32 bits128 bits
Typical notationDotted decimal, such as 192.0.2.1Colon-separated hexadecimal
Separator characterPeriod (.)Colon (:)
Numeric base used in notationDecimal, base 10Hexadecimal, base 16
Number and size of displayed groupsFour groups of 8 bitsEight groups of 16 bits

Standard IPv6 Written Notation

The fully expanded IPv6 pattern is:

xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx

There are eight groups separated by colons. In full notation, every group contains exactly four hexadecimal digits. For example:

2340:0023:AABA:0A01:0055:5054:9ABC:ABB0

Hexadecimal is a base-16 numbering system. It uses the decimal digits 0 through 9 and the letters A through F. Uppercase and lowercase letters have the same value, so ABCD and abcd represent the same IPv6 value.

Each group represents 16 bits. Since one hexadecimal digit represents four bits, four hexadecimal digits represent 4 × 4 = 16 bits.

Hexadecimal Fundamentals for IPv6

Hexadecimal is convenient for IPv6 because it expresses binary data compactly. One hexadecimal digit maps directly to four binary bits.

Hexadecimal digitBinary value
00000
10001
20010
30011
40100
50101
60110
70111
81000
91001
A1010
B1011
C1100
D1101
E1110
F1111

For example, the hextet A01F contains four hexadecimal digits:

A    0    1    F
1010 0000 0001 1111

That is 16 binary bits, as required for one IPv6 group.

Leading-Zero Suppression

Leading-zero suppression removes zeros from the left side of an individual hextet. It does not remove a group or change the number of colon-separated groups.

For example:

  • 0023 becomes 23.
  • 0A01 becomes A01.
  • 0055 becomes 55.
  • 0000 may become 0 when it is written as an individual group.

Applying this rule to a complete address:

2340:0023:AABA:0A01:0055:5054:9ABC:ABB0
2340:23:AABA:A01:55:5054:9ABC:ABB0

The address still contains eight groups. Only leading zeros were removed. Zeros in the middle or at the end of a hextet remain significant.

For example, A010 cannot be shortened to A1. The zero between A and 1, and the trailing zero, must remain. A valid shortened form is still A010.

Zero-Run Compression with a Double Colon

Zero compression replaces one contiguous run of one or more all-zero hextets with ::, called the double colon. An all-zero hextet is a group whose value is zero, such as 0000.

For example:

2340:0000:0000:0000:0455:0000:AAAB:1121
2340::455:0:AAAB:1121

The three consecutive 0000 groups after 2340 are replaced by ::. The separate zero group before AAAB remains as 0, because the double colon has already been used.

The double colon may appear no more than once in an IPv6 address. Each :: represents an unspecified number of zero groups. Using it twice would make it impossible to determine how many omitted groups belong to each marker.

2001::db8::1

This is invalid because it contains two double-colon markers.

A group that merely contains a zero is not eligible for replacement. For example, 0A01, 1000, and AB00 are nonzero hextets. They may have leading zeros removed when appropriate, but they cannot be replaced by ::.

Using Both IPv6 Shortening Rules

Leading-zero suppression and zero-run compression can be used in the same address:

1454:0045:0000:0000:4140:0141:0055:ABBB
1454:45::4140:141:55:ABBB
  • 0045 becomes 45.
  • The two consecutive zero hextets become ::.
  • 0141 becomes 141.
  • 0055 becomes 55.

Zero compression can also occur at the beginning:

0000:0000:0001:AAAA:BBBC:A222:BBBA:0001
::1:AAAA:BBBC:A222:BBBA:1

Here, the first two all-zero groups are replaced by ::. The third group, 0001, is shortened to 1.

Expanding a Shortened IPv6 Address

To expand an IPv6 address, restore it to eight groups of four hexadecimal digits.

  1. Split the address at the colons and count the visible groups.
  2. If there is a double colon, count how many groups appear before and after it.
  3. Insert enough 0000 groups at :: to make exactly eight groups.
  4. Pad every visible group on the left with zeros until it contains four hexadecimal digits.
  5. Verify that the result has eight groups, each with four digits.

Expand 2001:db8::5 as follows:

  • Visible groups: 2001, db8, and 5. There are three visible groups.
  • Eight total groups are required, so the double colon represents five zero groups.
  • Insert five 0000 groups.
  • Pad db8 to 0db8 and 5 to 0005.
2001:0db8:0000:0000:0000:0000:0000:0005

The expanded result has exactly eight hextets of four hexadecimal digits each.

IPv6 Shortening and Expansion Rules

RuleWhat may changeWhat must not changeExample
Leading-zero suppressionZeros at the left side of one hextet may be removed.Internal and trailing zeros must remain. The number of groups stays eight.0A01 becomes A01.
Zero-run compression with ::One contiguous run of all-zero hextets may become ::.Only one :: may appear. A nonzero hextet cannot be compressed.2001:0000:0000:0001 can contain 2001::1 when the complete address context supplies the remaining groups.
Expansion back to full notationOmitted leading zeros and zero hextets are restored.The result must contain exactly eight groups of four hexadecimal digits.2001:db8::5 becomes 2001:0db8:0000:0000:0000:0000:0000:0005.

Validation and Common Notation Mistakes

Expansion is a practical way to validate a shortened IPv6 address. If the address cannot be expanded to exactly eight valid hextets, its notation is incorrect.

More Than One Double Colon

2001::db8::10

This is invalid. Each double colon hides an unspecified number of zero groups, so two markers make the expansion ambiguous. Use :: only once and write other zero-valued groups explicitly as 0 or 0000.

Removing Significant Zeros

A010

Writing this as A1 is invalid because the zero is internal and the final zero is trailing. Only zeros before the first nonzero digit may be removed.

Incorrect Number of Groups After Expansion

For 2001:db8::1, there are three visible groups. The double colon must represent five zero groups, not an arbitrary number. An expansion with fewer or more than eight total groups is invalid.

A Group Longer Than Four Digits

2001:0db80:0000:0000:0000:0000:0000:0001

The group 0db80 contains five hexadecimal digits, which exceeds the 16-bit limit of one hextet. In full notation, every group must contain exactly four hexadecimal digits.

Invalid Hexadecimal Characters

IPv6 hexadecimal groups may contain only 0 through 9 and A through F, without regard to letter case. Characters such as G, H, or a hyphen are invalid in a hextet.

Exam-Ready Checklist

  • IPv6 addresses contain 128 bits.
  • IPv4 addresses contain 32 bits.
  • An IPv6 address has eight 16-bit hextets.
  • A fully expanded address has eight groups of four hexadecimal digits.
  • One hexadecimal digit represents four binary bits.
  • Leading zeros may be removed only from the left side of an individual hextet.
  • One contiguous run of all-zero hextets may be replaced by ::.
  • An IPv6 address may contain at most one ::.
  • When expanding, insert enough zero groups to reach exactly eight groups.
  • Always verify both the group count and the hexadecimal characters.

IPv6 address notation is valid when its shortened form can be expanded unambiguously into eight 16-bit hextets. For additional study, see IPv6 address format.