IPv6 Address Representation

IPv6 Addressing Format

IPv6 Address is ridiculously 128-bit or 16-byte long compared to the 32-bit IPv4 address. We all know that and it actually scares many of us. Good news is IPv6 is represented in hexadecimal number format whereas IPv4 is in decimal number format. Hence, each four bit in an IPv6 address is shrunken to a single hex digit, which means 128 binary bits are reduced down to 32 hex digits. Not only that, I think there were a group of artists šŸ˜‰ in the IETF IPv6 WG who thought it would look beautiful if we use semi-colon (:) instead of dot (.) used in IPv4. So, they chose to represent IPv6 addresses as ā€œColoned Hexā€ format: X:X:X:X:X:X:X:X (X = 16 bit field but represented by 4 hex digit).

IPv6 Address Representation

Rule 1: Leading zeroes within a 4-hex digit (16-bit) field may be omitted.


2031:0000:130F:0000:0000:09C0:876A:130B can be represented asĀ 2031:0:130F:0:0:9C0:876A:130B

Rule 2: Only a single occurrence of consecutive groups of zeroes may be replaced by a double colon (::).


2031:0:130F:0:0:9C0:876A:130B can be represented either asĀ 2031:0:130F::9C0:876A:130B orĀ asĀ 2031::130F:0:0:9C0:876A:130B but not asĀ asĀ 2031::130F::9C0:876A:130B

FF02:0000:0000:0000:0000:0000:0000:1Ā can be represented as FF02::1

2001:0000:0000:51F4:0000:00C8:C0A8:6420 can be represented either as 2001::51F4:0:C8:C0A8:6420 or as 2001:0:0:51F4::C8:C0A8:6420 but not as 2001::51F4::C8:C0A8:6420

3FFE:0501:0008:0000:0260:97FF:FE40:EFAB can be represented asĀ 3FFE:501:8::260:97FF:FE40:EFAB

Note 1

RFC5952 recommends that the rightmost set of :0: be replaced with :: for consistency.


2001:db8:0:2f::5 rather than 2001:db8::2f:0:0:0:5

2001:db8:0:0:15::5 rather than 2001:db8::15:0:0:5

Note 2

The hexadecimal digits A-F are case-insensitive in IPv6 address representation. Life saved, isn’t it!

2001:DB8:2F:B::A represents the same address as 2001:db8:2f:b::a

Prefix Representation

Representation of prefix is just like IPv4 CIDR. Like an IPv4 address:, IPv6 address is represented in the same way: 2001:db8:12::/40

Leave a Reply