Nibbles & Bits

IPv6 Compression Rules: All You Need to Know but Were Afraid to Ask

by | July 6, 2022

For years, the internet and the devices that connect to it have steadily been working toward IPv6 from the previous version of the internet protocol, IPv4. As the world was quickly running out of IP address options due to the proliferation of digital devices, it became important to upgrade to IPv6 to open up trillions of more potential IP addresses. This vast expansion in capacity is due to the use of 128-bit addresses in IPv6 as opposed to just 32-bit addresses in IPv4. 

Of course, it follows that IPv6 addresses will be much longer than their predecessors, due to all of those extra bits. In its natural state, an IPv6 address uses eight fields that are separated by colons, and within each of those eight fields is 16 bits. To make this new protocol easier to use, it’s helpful to compress the address into something a little more manageable. However, there are rules that must be followed to perform the compression correctly and still point to the correct address. Let’s take a closer look at how the compression rules work below. 

Following the Three Rules of IPv6 Compression
To properly compress an IPv6 address down into something more manageable and easier to use, there are three rules that you must follow. Properly adhering to these three rules means the address you are left with will correspond properly to the full-length version that you started with. The three rules are as follows –

Rule One – Zero Compression
To start with, a run of continuous zeroes can be eliminated when compressing an IPv6 address. In the place of those zeroes, you simply use a double colon or “::” symbol. Rather than the single colon that typically breaks up the eight fields of the address, this double colon is an indication that a segment of continuous zeroes has been removed. For example, consider the two versions of an IPv6 address below –

  • Before: 1111 : 0000 : 0000 : 0000 : 1234 : abcd : abcd : abcd
  • After: 1111 :: 1234 : abcd : abcd : abcd

The double-colon has removed the block of 12 zeroes in the middle of the address, and the compressed version is significantly smaller as a result.

Rule Two – Leading Zero Compression
In this rule, you are still getting rid of zeroes, but in this case, it’s the leading zeroes in each field that will be eliminated. So, if any of the eight fields in the address starts with a zero, or multiple zeroes, you can remove those zeroes without impacting the resulting address. In this case, you would not use the “::” symbol, and would instead just stick with the standard single colon divider between fields. Again, we’ll look at an example –

  • Before: 1111 : 0123 : 0012 : 0001 : abcd : 0abc : 9891 : abcd
  • After: 1111 : 123: 12 : 1 : abcd : abc : 9891 : abcd

In this case, the compression pulls out the leading zeroes in each segment, accounting for a total of seven fewer characters being used in the address.

Rule Three – Discontinuous Zero Compression
Finally, the third rule allows you to deal with an address that has a discontinuous pattern of zeroes. To compress such an address, the first section of zeroes is replaced with the “::” symbol. Then, for the next zero fields, you can simply shorten them to one zero each and divide them with a single colon. One last example will help make this point rule clearer –

  • Before: 1111 : 0 : 0 : abcd : 0 : 0 : 1234 : abcd
  • After: 1111 :: abcd : 0 : 0 : 1234 : abcd

Here, the first joining of zeroes has been dropped in favor of a double colon, while the second set of consecutive zeroes was left in its original state.

It’s much more appealing to work with IPv6 addresses when you have a quick and easy way to compress them down into a more manageable length. Now that you know the rules for compression, it will be easy to deploy these rules any time you need to handle these longer IP address forms. Also, there are several free compression tools available online to automate the process of shortening such an address. You may see this in action here IPv6 Calculator. If you are in the process of converting to IPv6, or have recently completed such a conversion and are trying to get used to the new system, knowing how to compress addresses properly will make life a little easier.

You have IPv6!

You’re on IPv4.

Explore ProVision Suite

Resource Controller



DHCP Controller

Peering Controller


Talk to one of our Engineers