IPv6 Compressor & Expander

Convert an IPv6 address between its fully expanded 32-character form and its shortest compressed representation.

Understanding IPv6 Compression Rules

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, 0db8 becomes db8, and 0000 becomes 0.
  • 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. So 2001:db8:0:0:0:0:2:1 becomes 2001:db8::2:1.