Skip to main content
Explainer · networking

IPv6 address format explained

An IPv6 address looks intimidating the first time you see one, but it follows a handful of simple rules. Once you know how the eight hex groups are laid out, how the two compression rules work, and how the prefix splits network from host, every IPv6 address becomes readable at a glance.

128 bits, written as eight groups of four hex digits

Every IPv6 address is 128 bits long — four times the size of an IPv4 address. Writing 128 ones and zeros would be unreadable, so the address is grouped into eight blocks of 16 bits and each block is written as four hexadecimal digits. The eight groups are separated by colons. A fully written-out address therefore looks like this:

2001:0db8:0000:0000:0000:ff00:0042:8329

Each hex digit stands for four bits, so four digits cover 16 bits and eight groups cover the full 128 bits. Hexadecimal uses the digits 09 and the letters af, where a is ten and f is fifteen. Case does not matter — lowercase is conventional — so FF00 and ff00 mean the same thing. This form, with every zero written out, is called the fully expanded or uncompressed representation. You will rarely see it in the wild, because two rules let you shorten it dramatically.

The two compression rules

IPv6 addresses are full of zeros, so the notation defines two independent ways to drop them. You can apply both to the same address.

Rule 1 — drop leading zeros in each group

Within any single group you may remove leading zeros. A group of 0000 becomes 0, 0db8 becomes db8, and 0042 becomes 42. You may only drop zeros at the front of a group — ff00 keeps its trailing zeros, because those are significant. Applying this rule to the example above turns it into:

2001:db8:0:0:0:ff00:42:8329

Rule 2 — collapse one run of all-zero groups with ::

A double colon (::) replaces a single consecutive run of groups that are entirely zero. Because the total is always eight groups, a reader can count the groups that are present and know exactly how many all-zero groups the :: stands in for. Collapsing the three zero groups in the middle of our example gives the final, canonical form:

2001:db8::ff00:42:8329

The single most important constraint is that :: may appear only once in an address. If it appeared twice there would be no way to know how many zero groups belonged on each side, so an address like 2001:db8::1::2 is invalid. When two separate runs of zeros exist, you collapse only one of them — by convention the longest run, and if two runs are equally long, the first one.

Worked examples

Reading these both ways is the fastest route to fluency.

The prefix: network half and interface half

Like IPv4, IPv6 uses CIDR notation — a slash followed by a number — to mark how many leading bits form the network prefix. The number is the count of network bits; the remaining bits identify a host or subnet within that network. Because an address is 128 bits, the value after the slash can range from /0 to /128.

Two boundaries dominate real deployments. A /64 is the standard size of a single subnet: the first 64 bits are the network prefix and the last 64 bits are the interface identifier that names an individual host on that link. Nearly every ordinary IPv6 LAN is a /64, and features like stateless address autoconfiguration assume it. A /48 is a typical allocation handed to an entire site or organisation; it leaves 16 bits of subnet space, which is 65536 distinct /64 networks — plenty for even a large campus. So an ISP might delegate a /48 to a business, and that business carves it into as many /64 subnets as it needs.

The 64-bit interface identifier is often derived from the network card, generated randomly for privacy, or assigned manually. Either way, the split at bit 64 is the mental model to hold: the left half says which network, the right half says which interface.

Address types you will actually meet

IPv6 reserves specific prefixes for specific jobs. You can identify the purpose of most addresses just by looking at how they start.

No broadcast, and usually no NAT

IPv6 deliberately has no broadcast address. In IPv4, a broadcast reaches every host on a link and forces each one to process the packet, which is wasteful. IPv6 replaces that entirely with multicast: a packet goes only to the interfaces that have subscribed to the relevant group. Even address resolution, which used broadcast ARP in IPv4, uses a solicited-node multicast group in IPv6.

IPv6 also removes the everyday need for network address translation. IPv4 leaned on NAT because addresses were scarce — many devices shared one public address. With 128 bits there is no scarcity, so a typical IPv6 deployment gives every device a globally unique, directly routable address and lets a stateful firewall, rather than address translation, control what may reach it. That end-to-end model is one of IPv6's defining advantages, though it shifts the security job squarely onto the firewall.

How this compares to IPv4

IPv4 addresses are 32 bits written as four decimal numbers separated by dots, such as 192.0.2.10 — the familiar dotted-decimal format, where each number is one 8-bit octet from 0 to 255. IPv6 keeps the idea of a prefix and a host portion but changes almost everything else: 128 bits instead of 32, hexadecimal instead of decimal, colons instead of dots, and eight groups instead of four. The zero-compression rules have no IPv4 equivalent because IPv4 addresses are short enough to write out in full. For a fuller side-by-side, see IPv4 vs IPv6. The payoff of all those extra bits is an address space so large that the practical constraints of IPv4 — exhaustion, sharing, NAT — simply do not apply.

Frequently asked questions

Why can you only use the :: shorthand once in an IPv6 address?

Because :: means “fill this gap with as many all-zero groups as needed to reach eight groups total.” If you used it twice, a reader could not tell how many zero groups belong on each side of each ::, and the address would be ambiguous. Using it once keeps the expansion unique: count the groups you can see, and the :: supplies the rest. That is why 2001:db8::1::2 is invalid while 2001:db8::1 is fine.

What is the difference between a /64 and a /48?

The number after the slash is the prefix length — how many leading bits identify the network. A /64 is the standard size of a single subnet: 64 network bits and a 64-bit interface identifier for hosts. A /48 is a common allocation to a whole site; it contains 65536 separate /64 subnets, giving an organisation room to number many internal networks.

Why does IPv6 have no broadcast address?

IPv4 used broadcast to reach every host on a link at once, which forces every device to process the packet. IPv6 replaces broadcast with multicast, delivering only to the specific group of interfaces that have subscribed to an address. The tasks that used broadcast in IPv4, like address resolution, use well-defined multicast groups instead, so IPv6 never needs a link-wide broadcast.

Related reading