Home CCNA IPv6 Address Representation: Formats, Compression, and Prefix Notation
CCNA

IPv6 Address Representation: Formats, Compression, and Prefix Notation

A Visual Comparison Of Ipv6 Address Formats, Showcasing Preferred And Compressed Representations For Efficient Networking.

An IPv6 address is 128 bits long, written as eight groups of four hexadecimal digits separated by colons, where each group represents 16 bits. Addresses can be written in lowercase or uppercase. The preferred format is x:x:x:x:x:x:x:x, where each x is a group of four hexadecimal digits. Each such group is called a hextet — so a single hextet is 16 bits, or four hexadecimal digits, and a full address is eight hextets (32 hexadecimal digits in total).

The Range of IPv6 Addresses

IPv6 addresses run from 0000:0000:0000:0000:0000:0000:0000:0000 to FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF. This is expressed in hexadecimal, and each hextet maps to 16 binary bits — for example, the hextet 0000 equals 0000000000000000 (sixteen 0s), and FFFF equals 1111111111111111 (sixteen 1s).

Since IPv6 is written in hexadecimal, it helps to keep the relationship between binary, decimal, and hexadecimal clear:

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

A full IPv6 address in preferred format looks like the examples below. Each is eight hextets, written out with all leading zeros in place:

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

Writing addresses out in full like this is correct but verbose. Two rules, defined in RFC 4291 and refined in RFC 5952, let us shorten them.

Shortening IPv6 Addresses

Rule 1 — Omitting Leading Zeros

The first rule is to omit the leading zeros in any hextet. This removes only leading zeros, never trailing ones — otherwise the address would become ambiguous.

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

Applying this rule to the preferred-format examples above gives the following. Note how trailing zeros are kept (1000 and A000 stay intact, 0200 becomes 200 not 2):

Preferred FormatOmitting Leading 0s
2001:0000:0000:1111:1234:1000:A000:01002001:0:0:1111:1234:1000:A000:100
2001:0DA1:B111:0000:0000:ABCD:0BCD:12452001:DA1:B111:0:0:ABCD:BCD:1245
FE80:0000:2BCD:0000:1234:4567:89AB:CDEFFE80:0:2BCD:0:1234:4567:89AB:CDEF
FE80:8BAB:0000:0000:0000:0000:0000:0123FE80:8BAB:0:0:0:0:0:123
FF02:0000:0000:0000:0000:0000:0000:0001FF02:0:0:0:0:0:0:1
FE02:0000:ABBB:0000:0000:0001:FF00:0200FE02:0:ABBB:0:0:1:FF00:200
0000:0000:0000:0000:0000:0000:0000:00010:0:0:0:0:0:0:1
0000:0000:0000:0000:0000:0000:0000:00000:0:0:0:0:0:0:0

Rule 2 — Replacing a Run of Zeros with a Double Colon

The second rule uses a double colon (::) to replace a single, contiguous run of one or more all-zero hextets. The :: can be used only once in an address — using it twice would make the result ambiguous, because there would be more than one way to expand it back.

For example, given FE02:0000:ABBB:0000:0000:0001:FF00:0200, you cannot write FE02::ABBB::1:FF00:200 — that uses :: twice and is invalid.

Combining both rules (omitting leading zeros and using :: for the longest zero run) produces the compressed format. Applying it to the addresses from the table above:

Omitting Leading 0sCompressed Address
2001:0:0:1111:1234:1000:A000:1002001::1111:1234:1000:A000:100
2001:DA1:B111:0:0:ABCD:BCD:12452001:DA1:B111::ABCD:BCD:1245
FE80:0:2BCD:0:1234:4567:89AB:CDEFFE80::2BCD:0:1234:4567:89AB:CDEF
FE80:8BAB:0:0:0:0:0:123FE80:8BAB::123
FF02:0:0:0:0:0:0:1FF02::1
FE02:0:ABBB:0:0:1:FF00:200FE02:0:ABBB::1:FF00:200
0:0:0:0:0:0:0:1::1
0:0:0:0:0:0:0:0::

Two rows above are worth studying, because they show the “use :: only once” rule in action:

  • FE80::2BCD:0:1234:4567:89AB:CDEF — the address has two separate single-zero hextets. Only the first is replaced with ::; the later 0 is left as 0, because :: can’t appear twice.
  • FE02:0:ABBB::1:FF00:200 — the run of two zeros (positions 4–5) becomes ::, while the single 0 at position 2 stays 0. You compress the longer run, not the isolated zero.

Common Mistakes in IPv6 Shortening

1. Using :: more than once

The :: may appear only once, replacing a single run of consecutive zeros.

  • Wrong: 2001::db8::1 (two ::)
  • Right: 2001:db8::1

2. Not compressing the longest zero run

RFC 5952 requires replacing the longest run of consecutive zero groups. If two runs are the same length, compress the leftmost one.

  • Original: 2001:0db8:0000:0000:0000:ff00:0042:8329
  • Wrong: 2001:db8:0::ff00:42:8329 (compressed only one group instead of three)
  • Right: 2001:db8::ff00:42:8329 (the run 0000:0000:0000::)

3. Truncating trailing zeros (not just leading ones)

You may remove leading zeros in a hextet, but never trailing zeros — that changes the value.

  • Wrong: abc0abc (this changes ABC0 into 0ABC, a different value)
  • Wrong: 0370037 (drops a trailing zero — invalid)
  • Right: 0370370 (drops only the leading zero — valid)
  • Right: fe80:0000:0000:0000:0000:0000:0000:0001fe80::1 (writing fe80::0:1 instead adds an unnecessary zero)

4. Invalid placement or extra colons

The :: replaces one or more full 16-bit zero groups; you can’t stack extra colons.

  • Wrong: 3ffe:0500:0000:0000:0000:0000:0000:00013ffe:500::::1 (too many colons)
  • Right: 3ffe:500::1

5. Trying to compress non-consecutive zeros

:: compresses only consecutive zero groups, not scattered ones.

  • Original: 2001:0:0:ff00:0:0:0:1
  • Wrong: 2001::ff00::1 (two ::)
  • Right: 2001::ff00:0:0:1 (compress the leftmost run; the later zeros stay as 0)

6. Over-compressing a single zero group

A single zero hextet is written as 0, not ::.

  • Wrong: 2001:0db8:0:0:1:0:0:12001:db8::1::1 (two ::)
  • Right: 2001:db8:0:0:1::1

7. Misrepresenting the special addresses

The loopback (::1) and unspecified (::) addresses have fixed forms.

  • Wrong: 0:0:0:0:0:0:0:1::::::1
  • Right: ::1

Best Practices Summary

  1. Use :: once, on the longest consecutive zero run.
  2. Remove leading zeros in a hextet (0db8db8).
  3. Keep trailing zeros (abc0 stays abc0).
  4. For equal-length zero runs, compress the leftmost.
  5. Validate shortened addresses with a trusted IPv6 tool if unsure.

Valid vs. Invalid Shortening at a Glance

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

Following these rules and RFC 5952 keeps your IPv6 representation accurate and unambiguous.

Prefix Length Notation

The leftmost bits of an IPv6 address, expressed in CIDR format, are the network prefix — the IPv6 equivalent of an IPv4 subnet mask. The notation uses a value from 1 to 128 to indicate how many bits belong to the network portion.

For example, in 2001:ABC8:1000:000C:0000:0000:0000:0001/64, the prefix 2001:ABC8:1000:000C::/64 is the network, and the range for this network runs from 2001:ABC8:1000:000C:0000:0000:0000:0000/64 to 2001:ABC8:1000:000C:FFFF:FFFF:FFFF:FFFF/64.

In that address, the first three hextets (48 bits) 2001:ABC8:1000 are the global routing prefix, the next 16 bits (000C) are used for subnetting within the organization, and the final 64 bits identify individual hosts. The prefix length tells you how many bits of a global unicast address make up the network portion.

Network administrators typically choose prefix lengths that are multiples of four, since each additional 4 bits shifts the network boundary exactly one hexadecimal digit to the right — which is easy to reason about without a subnet calculator. The table below shows common prefix lengths and the number of addresses each contains. (The total is calculated as 2^(128 − prefix length).)

Prefix LengthNetwork Portion ExampleTotal Addresses (2^(128 − n))Notes
/32000::/32¹²⁵The global unicast address (GUA) block — the range currently assigned for public IPv6.
/162001::/162¹¹²Blocks assigned to Regional Internet Registries (RIRs).
/322001:db8::/322⁹⁶Documentation/example prefix reserved by RFC 3849.
/482001:db8:1234::/482⁸⁰Common assignment to an organization (supports 65,536 /64 subnets).
/642001:db8:1234:5678::/642⁶⁴Standard subnet size for an end network (required for SLAAC).
/128::1/1281 (2⁰)A single host — for example, the loopback address ::1.

Key Notes

  • Global unicast range. Public IPv6 unicast addresses come from 2000::/3. You’ll often see individual allocations written with longer prefixes (a /32 to an ISP, a /48 to an organization, a /64 to a LAN), all carved out of that /3 block.
  • Total addresses. The count for any prefix is 2 raised to the number of host bits, i.e. 2^(128 − prefix length). For a /64, that’s 2⁶⁴ addresses per subnet; for a /48, 2⁸⁰.
  • Special cases. /64 is the standard (and, for SLAAC, required) subnet size for end networks, and /128 denotes a single host such as the loopback ::1.

FAQs

What is the preferred format for IPv6 addresses?

Eight groups (hextets) of four hexadecimal digits each, separated by colons — for example, 2001:0db8:0000:0000:0000:0000:0000:0001. All leading zeros are shown. This is the fully expanded, unambiguous form.

How can IPv6 addresses be compressed?

Two rules: omit the leading zeros in each hextet (0db8db8), and replace one contiguous run of all-zero hextets with ::. The :: can be used only once per address.

Why is IPv6 compression important?

It makes long addresses far easier to read, write, and manage, while RFC 5952’s rules ensure everyone compresses the same address the same way — avoiding ambiguity.

Can :: be used more than once in an address?

No. It may appear only once, because a second :: would make it impossible to know how many zero groups each one represents. Compress the longest run (leftmost, if there’s a tie) and leave any other single zeros as 0.

What prefix length is typical for a host’s subnet?

/64 is the standard subnet size for end networks. The first 64 bits are the network prefix (global routing prefix plus subnet ID) and the last 64 bits are the interface identifier (host portion). A host address like 2001:db8:abcd:1234::1 sits in the 2001:db8:abcd:1234::/64 network. Shorter prefixes such as /32 or /48 are allocated to ISPs and organizations for further subnetting.

How does IPv6 handle multicast?

IPv6 replaces IPv4’s broadcast with multicast: packets destined for a multicast address (in the FF00::/8 range) are delivered to all interfaces that have joined that group.

About This Content

Author Expertise: 10 years of experience in Enterprise network architecture, routing and switching, IPv4/IPv6 management, network automation, and security fundamentals.. Certified in: CCNP, CCNA
Avatar Of Asad Ijaz
Asad Ijaz

Editor & Founder

Lead Networking Architect and Editor at NetworkUstad. CCNP and CCNA certified, with 10+ years of experience in enterprise network design, implementation, and troubleshooting. Writes practical tutorials on routing, IPv4 management, network automation, and security fundamentals.

Related Articles