Last updated: 7 October 2021

When IPv4 addresses were invented in the early 1980s nobody suspected the world would ever run out of IP addresses. An IPv4 address is a 32-bit address (232) and allows for over 4 billion IP addresses. But then the world wide web happened, and now we have run out of IPv4 addresses.

The solution to the problem is IPv6. An IPv6 address has 128 bits (2128). With each bit the number of possible IP addresses doubles. So, a 33 bits gives you over 8 billion values, 34 bits over 16 billion and so forth. The number of IPv6 addresses is insanely large.

Hexadecimals and hextets

An IPv4 address is made up of four eight-bit octals. If you are reading this then I am sure you easily recognise an IPv4 address:

$ dig A +short

IPv6 addresses are are made up of eight hextets separated by colons. Each hextet has four hexadecimal digits, and each digit uses four bits. So, each hextet has 16 bits (4 * 4). And because we got eight hextets we got a 128-bit address (8 * 16 = 128). If you are not familiar with the base-16 system, my article about hexadecimal numbers goes over the details.

Here is an example IPv6 address:

$ dig AAAA +short

The address looks a little intimidating – in particular if you are not familiar with the base-16 system. Still, using hexadecimals makes IPv6 addresses relatively readable. It is possible to use octets instead, like we do with IPv4. However, an IPv6 address would have 16 octets. For instance, the above address would become this:

Suppressing and compressing zeros

Clearly, IPv6 has a “readability problem”. That is unavoidable – it is the price we pay for a near-infinite pool of IP addresses. However, there are some techniques to shorten IPv6 addresses.

The first is suppressing zeros. You might have noticed that the third, fourth and fifth hextet in the AAAA record have fewer than four digits. That is because leading zeros may be omitted. So, the third hextet is 0220, which can be written as 220. The fourth hextet is 0001, which can be shortened to just 1. You get the idea.

Similarly, consecutive hextets that are 0 can be replaced with a single colon. This is known as compressing zeros. To illustrate, this is one of Cloudflare’s public DNS servers:


The address is made up of three hextets followed by an extra colon and another hextet. We know that an IPv6 address has eight hextets and that an extra colon takes the place of consecutive hextets that are zero. So, the full address is:


The colon-trick can be performed only once in an IPv6 address. For instance, this is not a valid IPv6 address:


The problem with the address is that it is impossible to know how many “zero hextets” need to be added where. There are five hextets in the above address that are all zero, but you have no way of telling how many of them go before and after the 4700 hextet.

The network and host portion

Just as with IPv4, there are different types of IPv6 addresses. The most common type is the global unicast address. This is a public IPv6 address. The address is routable (i.e. you can connect to it from anywhere in the world) and has to be unique – two routable nodes can’t have the same IP.

A global unicast address is typically a /64 address. This means that the first 64 bits – that are the first four hextets – are the network portion. The last four quartets are the host portion.

Network            | Nodes             

The last hextet in the network portion can be used for subnets. So, the network part is made up of a 48-bit global routing prefix and a 16-bit subnet identifier. And now that we are doing jargon bingo, the remaining 64 host bits are also known as the interface identifier.

Subnets are not always /64 addresses. If you are interested in subnetting, you can learn in my article about subnets in IPv6.

IPv6 prefix assignment

The allocation of IP addresses is overseen by IANA. The body follows the RFC3513 specification. Among others, the specification states that the prefix 2000::/3 is reserved for global unicast addresses. This means that the first hextet of an IPv6 address can tell you what type of address it is. I explain the 2000::/3 prefix in more detail in the above-mentioned article about subnets in IPv6.

The second hextet is managed by the five Regional Internet Registries. An RIR manages the allocation of IP addresses for a region of the world. For instance, the RIR for Europe, the Middle East and parts of Central Asia is RIPE. The RIRs get huge blocks of IPv6 addresses from IANA and assign IPv6 ranges to Internet Service Providers in their region. The IANA website lists the global unicast address assignments to RIRs. RIPE has IPv6 prefixes such as 2001:0800::/22 and 2001:0c00::/23.

ISPs enter the stage at the third hextet, and they in turn assigned IPv6 addresses to their customers. They can then use the fourth hextet for subnets.