IPv6 addresses are naturally quite long (128 bits, represented as eight groups of four hexadecimal digits). To make them easier to read and write, two main rules of compression are applied:
- Omission of Leading Zeros: Within any of the eight groups, leading zeros can be removed. For example,
0db8becomesdb8, and0000becomes0. - Zero Compression (Double Colon): One consecutive sequence of groups containing only zeros can be replaced by a double colon
::. This can only be used once per IPv6 address to prevent ambiguity. So2001:db8:0:0:0:0:2:1becomes2001:db8::2:1.