A visual comparison of IPv6 address formats, showcasing preferred and compressed representations for efficient networking.

IPv6 Address Representation – An Exclusive Explanation

IPv6 addresses are 128 bits and represented as eight groups of four hexadecimal digits each, each group representing 16 bits. The address can be written in both lowercase and uppercase. The preferred format for writing an IPv6 address is x: x: x: x: x: x: x: x, where each “x” is a group of four hexadecimal digits, and each group contains 16 bits. The term used for a group is a hextet.  So, each “x” is a single hextet, 16 bits, or four hexadecimal digits.

The range of IPv6 addresses is 0000:0000:0000:0000:0000:0000:0000:0000 to FFFF: FFFF: FFFF: FFFF: FFFF: FFFF: FFFF: FFFF. This expression is in hexadecimal. If we convert one hextet into binary, it should be 16 bits. For example, we have a hextet “0000” that is equal to 0000000000000000 (16 time 0s), and hextet “FFFF” is equal to 1111111111111111 (16 tim1 1s). The following is the primary relationship table of binary, decimal, and hexadecimal.

DecimalBinaryHexadecimal
000000
100011
200102
300113
401004
501015
601106
701117
810008
910019
101010A
111011B
121100C
131101D
141110E
151111F

The ideal method of representing IPv6 addresses is groups of eight hextet (32 hexadecimal digits). However, there are two rules we can apply to reduce the number of digits needed to represent an IPv6 address. The preferred format for representing an IPv6 address is the following.

2001 : 0000 : 0000 : 1111 : 1234 : 1000 : A000 : 0100

2001 : 0DA1 : B111 : 0000 : 0000 : ABCD : 0BCD : 1245

FE80 : 0000 : 2BCD : 0000 : 1234 : 4567 : 89AB : CDEF

FE80 : 8BAB : 0000 : 0000 : 0000 : 0000 : 0000 : 0123

FF02 : 0000 : 0000 : 0000 : 0000 : 0000 : 0000 : 0001

FE02 : 0000 : ABBB: 0000 : 0000 : 0001 : FF00 : 0200

0000 : 0000 : 0000 : 0000 : 0000 : 0000 : 0000 : 0001

0000 : 0000 : 0000 : 0000 : 0000 : 0000 : 0000 : 0000


Shortening IPv6 addresses

There are two rules defined for shortening IPv6 addresses in RFCs 2373 and 5952. The rules are important to understand.

Omitting Leading 0s

Omitting leading 0 is the first rule to reduce the notation of the IPv6 address. The following are the examples to omit any leading 0s (zeros) in any 16-bit section or hextet:

  • 0100 can be represented as 100
  • 0DA1 can be represented as DA1
  • 0123 can be represented as 123
  • 0000 can be represented as 0

This rule only omits leading 0s, not trailing 0s. Otherwise, the address would be ambiguous. The table below shows examples of omitting leading 0s from the IPv6 address.

The image is a table comparing the preferred format of IPv6 addresses with their versions omitting leading zeros. It showcases how the leading zeros can be removed to simplify and compress IPv6 addresses.
IPv6 Address Representation - An Exclusive Explanation 4

Omit All 0 Segments

The second rule reduces the notation of IPv6 addresses using a double colon (::) that can replace any single, contiguous string of one or more hextet containing all 0s. The double colon (::) can only be used once within an address; otherwise, there would be more than one possible resulting address. For example, if we have an IPv6 address FE02: 0000 : ABBB: 0000: 0000: 0001: FF00: 0200 and we apply the technique like FE02:: ABBB:: 1: FF00: 200. it is not correct. When used with the omitting leading 0s technique, the notation of the IPv6 address can often be greatly reduced. This is commonly known as the compressed format.

The image is a table comparing IPv6 addresses with leading zeros omitted to their compressed forms. It illustrates how IPv6 addresses can be simplified by omitting leading zeros and using shorthand notation.
IPv6 Address Representation - An Exclusive Explanation 5

Common Mistakes & Examples in IPv6 Address Shortening

1. Using Multiple “::” in a Single Address

The double colon (::) can only be used once to replace the longest consecutive sequence of zeros.

  • Mistake:
    2001::db8::1
    (Two :: symbols, which is invalid.)
  • Correct:
    2001:db8::1
    (Single :: replaces the longest zero sequence.)

2. Failing to Compress the Longest Zero Run

RFC 5952 mandates replacing the longest consecutive zero groups. If multiple runs exist, compress the leftmost longest run.

  • Original Address:
    2001:0db8:0000:0000:0000:ff00:0042:8329
  • Mistake:
    2001:db8:0::ff00:42:8329
    (Shortened only one zero group instead of three.)
  • Correct:
    2001:db8::ff00:42:8329
    (Replaces the longest zero sequence: 0000:0000:0000 → ::.)

3. Incorrectly Truncating Non-Zero Groups

Leading zeros in a group can be removed, but trailing zeros cannot.

  • Mistake:
    2001:0db8:85a3:0000:0000:8a2e:0370:7334 → 2001:db8:85a3::8a2e:370:7334
    (Truncated 0370 to 370, which is valid. However, if the group was 0370, truncating to 370 is correct. If it was 037f, truncating to 37f would be wrong.)
  • Edge Case:
    fe80:0000:0000:0000:0000:0000:0000:0001 → fe80::1 (Correct).
    Mistakenly writing fe80::0:1 adds an unnecessary zero.

4. Ambiguous or Invalid Placement of “::”

The :: must replace a full 16-bit zero group (or consecutive groups).

  • Mistake:
    3ffe:0500:0000:0000:0000:0000:0000:0001 → 3ffe:500::::1
    (Too many colons; invalid syntax.)
  • Correct:
    3ffe:500::1

5. Shortening Non-Consecutive Zeros

:: can only compress consecutive zero groups, not scattered zeros.

  • Original Address:
    2001:0:0:ff00:0:0:0:1
  • Mistake:
    2001::ff00::1
    (Two :: symbols.)
  • Correct:
    2001::ff00:0:0:1
    (Compress the leftmost zero run first.)

6. Over-Compressing Single Zero Groups

A single zero group (0000) can be written as 0, but not ::.

  • Mistake:
    2001:0db8:0:0:1:0:0:1 → 2001:db8::1::1
    (Invalid double ::.)
  • Correct:
    2001:db8:0:0:1::1

7. Misrepresenting Special Addresses

Loopback (::1) and unspecified (::) addresses have fixed forms.

  • Mistake:
    0:0:0:0:0:0:0:1 → ::::::1
    (Invalid colon usage.)
  • Correct:
    ::1

Summary of Best Practices

  1. Use :: once to replace the longest consecutive zero sequence.
  2. Remove leading zeros in groups (e.g., 0db8 → db8).
  3. Keep trailing zeros (e.g., abc0 stays abc0, not abc).
  4. For equal-length zero runs, compress the leftmost one.
  5. Always validate shortened addresses with tools like IPv6 Test.

Examples of Valid vs. Invalid Shortening

Original AddressInvalid ShorteningCorrect Shortening
2001:0db8:0000:0000:0000:ff00:0042:83292001:db8:0::ff00:42:83292001:db8::ff00:42:8329
fe80:0000:0000:0000:0000:0000:0000:0001fe80::0:1fe80::1
3ffe:0500:0000:0000:0000:0000:0000:00013ffe:500::::13ffe:500::1
0000:0000:0000:0000:0000:0000:0000:0001::0:1::1

By avoiding these pitfalls and adhering to RFC 5952 standards, you’ll ensure accurate and unambiguous IPv6 address representation.

Prefix Length Notation

The most left bits of the IPv6 address and the network bits length represented in CIDR format are known as the network prefix. The prefixes in IPv6 are used similarly to the subnet mask of IPv4 addresses. In IPv6, we use a notation similar to the CIDR mask representation in IPv4. The notation values are between 1 and 128 to represent the network bits.

For example, in IPv6 address 2001: ABC8: 1000: 000C: 0000: 0000: 0000: 0001/ 64, 2001: ABC8: 1000: 000C::/64 represents the network prefix and the range for this IP network is from 2001: ABC8: 1000: 000C: 0000: 0000: 0000: 0001/64 to 2001: ABC8: 1000: 000C: ffff: ffff: ffff: ffff/64.

The first three hextet (48 bits ) 2001:ABC8:1000 are the IP version 6 global routing prefix, and the next 16 bits(hextet) “000C ” is used for internal subnetting within an organization, and the last 64 bits are used for internal hosts of the network. The length of the IPv6 prefix is used to recognize how many bits of a Global Unicast IP version 6 address are in the network.

Typically, Network Administrators and engineers choose prefix lengths that are multiples of four. That makes the prefix easier to comprehend without using a subnet calculator. Look at the table below to understand IPv6 Prefix. Each additional 4 in the prefix length moves the network portion of the address one hexadecimal digit to the right. 

Prefix LengthNetwork PortionTotal AddressesRemarks
/42000::/421242124– Reserved for future global unicast allocations.
– Example: 2xxx::/4 (where x is variable).
/82000::/821202120– Sub-range of /4 for large-scale allocations (e.g., continental ISPs).
/162001::/1621122112– Assigned to regional internet registries (RIRs).
/322001:db8::/32296296– Documentation/example prefix (RFC 3849).
/482001:db8:1234::/48280280– Standard assignment for organizations (supports 65k subnets).
/642001:db8:1234:5678::/64264264– Default subnet size for end networks (SLAAC/DHCPv6).
/128::1/12811– Loopback address (refers to the device itself).

Key Notes

  1. Network Portion:
    • For /4, the first 4 bits are fixed (e.g., 2 in hex = 0010 in binary), and the rest are variable.
    • Addresses like 2000::/4 are part of the global unicast range (2000::/3 is standard).
  2. Total Addresses:
    • Calculated as 2(128 − Prefix Length).
    • Example: For /4, 2(128 − 4) = 2124.
  3. Special Cases:
    • /64 is mandatory for SLAAC (Stateless Address Autoconfiguration).
    • /128 is a single-host address (e.g., ::1 for loopback).

FAQs

  • What is the preferred format for IPv6 addresses?

    IPv6 addresses are written in eight groups of four hexadecimal digits separated by colons. This format ensures clarity and consistency.

  • How can IPv6 addresses be compressed?

    IPv6 addresses can be compressed by omitting leading zeros and using “::” to replace consecutive sections of zeros, simplifying the representation.

  • Why is IPv6 address compression important?

    Compression reduces the length of IPv6 addresses, making them easier to read, write, and manage in networking tasks.

  • What are the benefits of IPv6 over IPv4?

    IPv6 offers a larger address space, improved security features, and better support for modern networking technologies like IoT.

  • How does IPv6 handle multicast addresses?

    IPv6 uses multicast addresses to send packets to multiple destinations simultaneously, replacing the broadcast method used in IPv4.

Avatar of Asad Ijaz

Asad Ijaz

NetworkUstad's lead networking architect with CCIE certification. Specializes in CCNA exam preparation and enterprise network design. Authored 2,800+ technical guides on Cisco systems, BGP routing, and network security protocols since 2018. Picture this: I'm not just someone who writes about tech; I'm a certified expert in the field. I proudly hold the titles of Cisco Certified Network Professional (CCNP) and Cisco Certified Network Associate (CCNA). So, when I talk about networking, I'm not just whistling in the dark; I know my stuff! My website is like a treasure trove of knowledge. You'll find a plethora of articles and tutorials covering a wide range of topics related to networking and cybersecurity. It's not just a website; it's a learning hub for anyone who's eager to dive into the world of bits, bytes, and secure connections. And here's a fun fact: I'm not a lone wolf in this journey. I'm a proud member and Editor of Team NetworkUstad. Together, we're on a mission to empower people with the knowledge they need to navigate the digital landscape safely and effectively. So, if you're ready to embark on a tech-savvy adventure, stick around with me, Asad Ijaz Khattak. We're going to unravel the mysteries of technology, one article at a time!"