Utilities

IPv6 Expander

Expand an IPv6 address into its eight full groups.

Processed in your browser

IPv6 addresses are normally written in a shortened form that leaves out zeros. The IPv6 Expander puts them back. It turns 2001:db8::1 into 2001:0db8:0000:0000:0000:0000:0000:0001: eight groups of four hexadecimal digits, with nothing left implied.

The short form is better for reading and typing. The full form is better for work that goes digit by digit, such as sorting addresses, building reverse DNS names or seeing where the network part of an address ends.

The expansion is done in your browser. The page shows "Processed in your browser", and the address is not sent to the IP Tracker server.

How to expand an address

  1. Type or paste an IPv6 address into the field, for example 2001:db8::1.
  2. Click Calculate.
  3. Copy the full form from the Result row.

Enter only the address. A prefix length such as /64, square brackets around the address, or an IPv4 address leads to the message "Enter a valid IPv6 address."

The same two values are available under the rows through "View as JSON", Copy JSON and Download JSON.

How to read the result

Input shows the address as you entered it. Result shows the expanded form, which always has the same shape: 32 hexadecimal digits in eight groups of four, separated by seven colons, 39 characters long.

Each digit stands for 4 bits, each group for 16 bits, and the eight groups together for the 128 bits of the address. Because the shape is fixed, position has meaning. The second digit of the third group covers the same four bits in every address.

Hexadecimal digits run from 0 to 9 and then a to f, where a is ten and f is fifteen. The Result row writes the letters in lowercase.

What the short form leaves out

Two kinds of zeros are missing from a shortened address. Inside each group, zeros at the front are dropped, so 0db8 is written db8 and 0000 is written 0. On top of that, one run of groups that are entirely zero may be replaced by a double colon, which can appear only once in an address.

Expanding reverses both steps. No information is lost in either direction, because an address always has exactly eight groups, and the number of missing ones can be worked out from that.

How to expand an address by hand

  1. Look for a double colon (::). If there is none, the address already has eight groups and only the last step applies.
  2. Count the groups that are written out, on both sides of the double colon.
  3. Subtract that count from eight. The answer is the number of zero groups the double colon stands for.
  4. Write the address again with that many groups of 0000 in place of the double colon.
  5. Pad every group to four digits by adding zeros on the left.

Take 2001:db8:a0::1:2. Five groups are written out: 2001, db8 and a0 before the double colon, 1 and 2 after it. Eight minus five is three, so the double colon stands for three zero groups. Putting them in gives 2001:db8:a0:0000:0000:0000:1:2, and padding each group gives 2001:0db8:00a0:0000:0000:0000:0001:0002.

A longer case is fe80::202:b3ff:fe1e:8329. One group stands before the double colon and four after it, five in all, so three zero groups are missing. Only 202 needs padding. The full form is fe80:0000:0000:0000:0202:b3ff:fe1e:8329.

A double colon at the start or the end works the same way. ::1 has one written group, so seven zero groups go in front of it. 2001:db8:: has two, so six zero groups follow.

Most errors in hand expansion come from a few slips.

  • Padding on the wrong side. Zeros go on the left: a0 becomes 00a0. Writing a000 would produce a different address.
  • Counting only the groups before the double colon. The groups after it count as well.
  • Treating the double colon as one zero group. It stands for a single group only when seven groups are written.
  • Skipping a zero group that is written as a plain 0. In 2001:db8:0:1::1 the third group is present and still has to be padded to 0000.

Short and full forms side by side

Short formFull form
::0000:0000:0000:0000:0000:0000:0000:0000
::10000:0000:0000:0000:0000:0000:0000:0001
ff02::2ff02:0000:0000:0000:0000:0000:0000:0002
2001:db8::12001:0db8:0000:0000:0000:0000:0000:0001
2001:db8:1::2001:0db8:0001:0000:0000:0000:0000:0000
2001:db8:0:1::12001:0db8:0000:0001:0000:0000:0000:0001
2001:db8:10::202001:0db8:0010:0000:0000:0000:0000:0020
2001:db8:abcd:12::52001:0db8:abcd:0012:0000:0000:0000:0005
2001:db8:85a3::8a2e:370:73342001:0db8:85a3:0000:0000:8a2e:0370:7334

The first two rows are the unspecified address and the loopback address. ff02::2 is the multicast address for all routers on the local link. The remaining rows come from 2001:db8::/32, the range reserved for documentation.

Why the full form is needed

Comparing and sorting come first. One address can be spelled in several short ways, and short forms differ in length, so a plain text sort puts them in the wrong order. Sorted as text, 2001:db8::10 comes before 2001:db8::2, although 2 is the smaller number. In full form the same addresses end in 0002 and 0010, and a text sort gets them right. For addresses in full lowercase form, text order and numeric order are the same.

Reverse DNS is the second use. The name that holds the PTR record of an IPv6 address is built from all 32 digits of the full form: remove the colons, reverse the order of the digits, put a dot between each of them and add ip6.arpa at the end. For 2001:db8::1 the name is 1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa. Nobody can write that name from the short form without expanding it first. To query the record itself, use Reverse DNS Lookup.

Rules and stored data are the third. Some firewalls, databases and scripts treat addresses as text. With a fixed-width form, every address has the same length, splits into exactly eight parts and can be matched by its leading characters. All addresses in the network 2001:db8:0:1::/64 start with 2001:0db8:0000:0001: in full form, which a text filter can match directly.

The full form also shows the structure of an address. In most networks the first 64 bits are the network prefix and the last 64 bits identify the interface, meaning one network connection of one device. Written in full, that boundary sits exactly in the middle, after the fourth group: 2001:0db8:85a3:0000:0000:8a2e:0370:7334 has the network 2001:0db8:85a3:0000 and the interface 0000:8a2e:0370:7334. The short form 2001:db8:85a3::8a2e:370:7334 hides the boundary inside the double colon.

An organization that receives a /48 from its provider commonly divides the address like this.

GroupsBitsUsual meaning
1 to 31 to 48The prefix assigned to the whole site
449 to 64The subnet inside the site
5 to 865 to 128The interface identifier of one device

Prefixes of other lengths are read the same way, four bits per digit. A /56 covers three groups plus the first two digits of the fourth.

Tasks where expanding helps

  • Creating a reverse DNS zone for a network. The zone name for 2001:db8:0:1::/64 uses the first 16 digits of the full form in reverse order: 1.0.0.0.0.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa.
  • Checking whether two differently written addresses are the same. Expand both and compare the results character by character.
  • Feeding addresses to a script or spreadsheet that splits on colons and expects eight parts.
  • Working out which subnet an address is in. In a site that was given a /48, the fourth group of the full form is the subnet number.

Addresses that people will read are better kept in the short form. IPv6 Compressor converts in that direction and always produces the same spelling for the same address.

What the expander does not do

It does not build the ip6.arpa name for you. It gives the full form, and reversing the digits is a manual step.

It does not accept a prefix length, so expand the address part of a block and keep the /64 or /48 aside. It works on one address at a time and on IPv6 only.

The tool changes how an address is written and nothing else. It makes no connection to the address and cannot say whether it is in use. For network and location data about a public address, use IP Lookup. To find the IPv6 addresses a hostname points to, use Hostname to IP.

Frequently asked questions

How many groups does a full IPv6 address have?

Eight. Each group has four hexadecimal digits and stands for 16 bits, which adds up to 128 bits. With the seven colons between the groups, the full form is 39 characters long.

How do I know how many zeros the double colon stands for?

Count the groups that are written and subtract from eight. In fe80::1 two groups are written, so the double colon stands for six groups of 0000.

This only works because the double colon is allowed once per address. An address with two of them is not valid, and the tool rejects it.

Is the expanded address a different address from the short one?

No. Both describe the same 128 bits. A server reached at 2001:db8::1 is the same server as 2001:0db8:0000:0000:0000:0000:0000:0001, and software accepts either spelling.

Why do reverse DNS names need the full form?

A reverse DNS name has one label for every hexadecimal digit of the address, 32 in all, in reverse order. Zeros that the short form leaves out are still part of the name, so they have to be written back in before the digits can be reversed.

Can the double colon be at the start or the end of an address?

Yes. ::1 starts with it and 2001:db8:: ends with it. The address :: consists of nothing else and expands to eight groups of zeros.

What is the full form of ::1?

It is 0000:0000:0000:0000:0000:0000:0000:0001. This is the loopback address, which a computer uses to reach itself. It does the same job as 127.0.0.1 in IPv4.

Why does an IPv6 address contain letters?

The groups are written in hexadecimal, a counting system with sixteen digits. After 0 to 9 it continues with a, b, c, d, e and f for the values ten to fifteen. One hexadecimal digit holds exactly 4 bits, which keeps a 128-bit address down to 32 digits.

How do I expand an address that has a prefix such as /64?

Take the prefix off, expand the address and put the prefix back. 2001:db8:0:1::/64 becomes 2001:0db8:0000:0001:0000:0000:0000:0000/64.