IPv6 Compress Calculator

Enter a full 8-group IPv6 address to get its compressed form.

How it is calculated

The input must be a full address of exactly eight groups separated by colons, each group 1 to 4 hex digits. Anything else, including an already shortened address that contains ::, is rejected. The tool applies the usual compression rules in order: letters are converted to lower case, leading zeros are removed from each group (0202 becomes 202, 0000 becomes 0), then the longest run of consecutive all-zero groups is replaced by ::. A run must be at least two groups long; a lone zero group stays written as 0. If two runs have the same length, the first one is collapsed. The expanded form (each group padded to four digits) is also returned, along with a note saying how many groups were replaced.

Worked example

Input: fe80:0000:0000:0000:0202:B3FF:FE1E:8329. Lower case and strip leading zeros: fe80, 0, 0, 0, 202, b3ff, fe1e, 8329. The longest run of zero groups is the three in the middle (groups 2 to 4), and these become ::. Result: fe80::202:b3ff:fe1e:8329. The expanded form is fe80:0000:0000:0000:0202:b3ff:fe1e:8329, and the note says a run of 3 zero groups was replaced.

Try this example →

Common mistakes

  • Pasting an address that is already shortened, such as 2001:db8::1. The tool needs all eight groups written out, so it gives no result for it.
  • Leaving a group with more than four hex digits or a character outside 0-9 and a-f. Such a group makes the whole address invalid.
  • Expecting a single zero group to be turned into ::. The double colon replaces only runs of two or more, so 2001:db8:1:0:1:1:1:1 stays as written.
  • Using :: twice by hand. If two separate zero runs exist, only the longest (or the first when tied) is collapsed, and the other is written as 0:0.
  • Pasting an address that has a prefix length (/64) or a zone name (%eth0). The extra text makes the last group invalid; remove it first.

About this calculator

A fully expanded IPv6 address has eight groups of four hexadecimal digits separated by colons (e.g. 2001:0db8:0000:0000:0000:ff00:0042:8329), which is accurate but unwieldy to read or type. Compression shortens it in two steps defined by RFC 5952: first, leading zeros within each group are stripped (0db8 becomes db8, 0042 becomes 42), and second, the single longest run of one or more consecutive all-zero groups is collapsed into a double colon ::, which can appear at most once in a compressed address since two would make the number of omitted groups ambiguous.

Applying both rules to the example above gives 2001:db8::ff00:42:8329 — dramatically shorter and easier to work with, while still expanding back to exactly the same 128-bit address. Network engineers and system administrators rely on this canonical compressed form when writing configuration files, DNS records (AAAA), firewall rules, and documentation, since consistent compression avoids ambiguity between equivalent representations of the same address; this calculator takes a full 8-group IPv6 address and returns its compressed form.

Was this helpful?

You can pick up to 3 reactions.

Comments

  • Be the first to comment.

Popular calculators

All Calculators