IPv6 notation guide

How to compress an IPv6 address

IPv6 compression makes a 128-bit address shorter to read and write without changing its value. The rules are precise: remove leading zeroes, abbreviate one eligible zero run, and use lowercase hexadecimal text.

Rule one

Remove leading zeroes from each group

An IPv6 address has eight groups of four hexadecimal digits in expanded form. Within each group, leading zeroes have no value and can be omitted. Keep at least one digit when a group contains only zeroes.

Expanded group

0db8

Compressed group

db8

Rule two

Use :: for one longest zero run

A sequence of two or more complete 0000 groups can be replaced with a double colon. Use this abbreviation only once in one address; otherwise it would be ambiguous how many zero groups are missing.

If multiple zero sequences have the same length, use the first sequence. A single zero group is written as 0, not ::.

Worked examples

IPv6 compression examples

2001:0db8:0000:0000:0000:0000:0000:0001

2001:db8::1

Leading zeroes removed; five zero groups collapsed.

fe80:0000:0000:0000:0202:b3ff:fe1e:8329

fe80::202:b3ff:fe1e:8329

Three zero groups collapsed; 0202 becomes 202.

2001:0db8:0000:0001:0000:0000:0000:0001

2001:db8:0:1::1

The longest three-group zero run is collapsed.

Reference addresses

Common special IPv6 addresses

These selected addresses have dedicated context and can be safely used as examples when learning IPv6 notation.

Standard notation

Why use a consistent IPv6 form?

A consistent compressed form prevents duplicate values in configuration, logs, databases, and URLs. It also makes troubleshooting easier because equivalent addresses are displayed the same way.