1. Home
  2. Developer tools
  3. IPv6 Compressor

IPv6 Compressor

Normalise IPv6 addresses to the one text form that RFC 5952 recommends, so logs, databases and configuration agree. Paste any valid form and get the canonical one.

Free, no sign-up. Runs in your browser: nothing is uploaded.

How to use IPv6 Compressor

  1. Paste IPv6 addresses, one per line.
  2. Read the shortest form of each.
  3. Copy the list.

Features

  • Follows RFC 5952 exactly
  • Longest run of zero groups becomes ::
  • First run wins a tie, single zero groups stay
  • Optional ::ffff:a.b.c.d for mapped addresses
  • Keeps a /prefix
  • Handles lists

Supported formats

Input

  • IPv6 addresses
  • Typed or pasted text

You get

  • Shortest RFC 5952 form

Private by design

Everything you enter is processed by your browser on this device. Nothing is sent to openWorkstand or anyone else, so the IPv6 Compressor is safe for private and work data. After you have used it once while online, it also works without an internet connection. How local processing works

Good to know

  • A single group of zeros is never replaced by :: (RFC 5952).
  • Output is always lower case, as the RFC recommends.

Guide

Writing IPv6 addresses in the canonical short form of RFC 5952

IPv6 allows many correct spellings of one address, which is fine for a router and a nuisance for humans and scripts. Searching a log, comparing two configuration files, or de-duplicating a list only works if everybody writes an address the same way. RFC 5952 defines that single recommended text form, and this page converts a list of addresses into it.

The rules

The canonical form follows five rules. Leading zeros in each group are removed (0db8 becomes db8). Hexadecimal letters are lower case. The longest run of two or more consecutive all-zero groups is replaced with ::. If two runs have the same length, the first one is replaced. And :: must never stand for just one group: a lone zero group is written as 0. The page applies these to every line. If the line carries a prefix length, such as /64, the prefix is left as typed.

The cases that are easy to get wrong

Choosing the longest run, not the first: in 2001:0:0:1:0:0:0:1 the second run has three zero groups and the first has two, so the result is 2001:0:0:1::1. Ties: in 2001:db8:0:0:1:0:0:1 both runs have two groups, so the first is shortened to give 2001:db8::1:0:0:1. Single zeros: 2001:db8:0:1:1:1:1:1 has one zero group, so it stays as written. Whole-address zero is ::, and the loopback address is ::1. These are exactly the places where hand-written addresses disagree with what operating systems print.

IPv4-mapped addresses

An address that embeds an IPv4 address in its last 32 bits is normally printed in hexadecimal, ::ffff:c000:201. Many tools print it with a dotted ending instead, ::ffff:192.0.2.1. RFC 5952 permits the dotted ending for addresses that embed an IPv4 address. A switch on the page chooses which style you receive.

A worked example

The sample list produces five lines. 2001:0db8:0000:0000:0000:ff00:0042:8329 becomes 2001:db8::ff00:42:8329 (the three middle zero groups collapse). The tie case becomes 2001:db8::1:0:0:1. The loopback address comes back as ::1. An EUI-64 style link-local address is reduced to fe80::202:b3ff:fe1e:8329, and the mapped address ::ffff:c000:201 stays in hexadecimal until you switch on the dotted option, when it reads ::ffff:192.0.2.1.

Limits

The page changes spelling only. It does not decide whether an address is valid for your network, and it does not touch a prefix. Text that is not an IPv6 address gets an error message on its line. To go the other way and see all 32 digits, use the IPv6 Expander.

Why one spelling matters

Tools disagree about how to print an address: a router may show 2001:db8:0:0:1:0:0:1, a Linux host 2001:db8::1:0:0:1 and an old script the fully padded form. Compare logs, access lists or inventories by text and the same address appears to be three different ones. Run the whole list through the compressor first, then sort and remove duplicates, and the comparison becomes reliable. The same applies to addresses embedded in URLs and configuration files, where square brackets surround the address and a zone identifier such as %eth0 can follow it.

Checking a result by hand

To verify a result, expand it again. Count the groups that are present, subtract from eight and you know how many zero groups the :: hides: 2001:db8::1:0:0:1 shows six groups, so the double colon stands for two zero groups. If expanding the compressed text gives back the original address, nothing was lost.

Checked against the current version of the IPv6 Compressor on .

Frequently asked questions

Why is 2001:db8:0:1:1:1:1:1 not shortened to 2001:db8::1:1:1:1:1?

RFC 5952 forbids using :: for a single zero group. It saves no space and would make the address look as if more than one group were missing, so the lone 0 stays.

Which one wins when two zero runs are the same length?

The first, reading left to right. For 2001:db8:0:0:1:0:0:1 the result is 2001:db8::1:0:0:1, never 2001:db8:0:0:1::1.

Which zero run is shortened when two are equal?

The first one. 2001:db8:0:0:1:0:0:1 becomes 2001:db8::1:0:0:1. A run of only one zero group is never shortened.

Why does case matter?

RFC 5952 requires lower case for hex digits so that the same address always has the same text, which makes searching and deduplication reliable.

Keep working with the result

openWorkstand also includes a free workspace with documents, spreadsheets, tasks, projects and a calendar that save to a folder on your computer.