HomeGuides › IPv6

How to read and write IPv6 addresses

Eight groups of four hex digits, shortened by two rules. Once those rules are clear, IPv6 addresses stop looking arbitrary.

An IPv6 address is 128 bits, written as eight groups of four hexadecimal digits separated by colons. Written in full they are long, so two shortening rules apply — and RFC 5952 makes both mandatory, so the same address is always written the same way.

Rule one: drop leading zeros in a group

0db8 becomes db8. 0000 becomes 0 — a single zero, never nothing.

Rule two: one run of zero groups becomes ::

A run of consecutive all-zero groups can be replaced by a double colon. Only one run, because two would be ambiguous — you could not tell how many groups each stood for.

Two details follow. The run chosen is the longest; when two runs are the same length, the first wins. And a run of a single zero group is never compressed, since :: would save no characters and add ambiguity.

Why /64 is everywhere

The convention is that a subnet is a /64, splitting the address into a 64-bit network prefix and a 64-bit interface identifier. That is a colossal subnet by IPv4 habits — more addresses than the entire IPv4 space, squared — and it is not about capacity.

It is because stateless address autoconfiguration, which is how hosts assign themselves an address without a DHCP server, expects 64 bits of interface identifier. Subnetting smaller than a /64 breaks it. This is why a residential connection is typically given a /56 or a /48: enough room for many /64 subnets rather than many addresses.

The ranges worth recognising

Frequently asked questions

Why can :: only appear once?

Because it stands for an unknown number of zero groups. Two of them would be ambiguous, since there would be no way to tell how many groups each represented.

Why is a single zero group written as 0 rather than ::?

RFC 5952 forbids compressing one group. It saves no characters and introduces ambiguity, so it is written out.

Why is an IPv6 subnet always a /64?

Because stateless address autoconfiguration expects a 64-bit interface identifier. Smaller subnets break it, so /64 is the standard subnet size regardless of how few hosts it holds.

Does IPv6 have a broadcast address?

No. Multicast handles what broadcast did in IPv4, which is why every address in an IPv6 prefix is usable and nothing is subtracted.

Open the IPv6 visualizer →