By the end of this guide, you will be able to expand, compress, and classify an IPv6 address and find its network prefix. For example, you will shorten 2001:0db8:0000:0000:0000:0000:0000:0042 to 2001:db8::42 without changing the address. IPv6 succeeds IPv4 and uses 128 bits, giving it a vastly larger address space. RFC 8200 (STD 86) is the base specification, RFC 4291 and its updates define the addressing architecture, and RFC 5952 recommends a canonical text format.
Address structure and notation
A full address has eight groups of four hexadecimal digits. Hexadecimal notation uses 0–9 and a–f, so one digit represents 16 possible values. In 2001:0db8:0000:0000:0000:0000:0000:0042, remove leading zeroes within each group and replace the longest run of all-zero groups with one ::. The result, 2001:db8::42, is a shorter spelling of exactly the same value.
- Use
::only once, or expansion would be ambiguous. - If equal-length zero runs tie, RFC 5952 chooses the first.
- Write hexadecimal letters
a–fin lowercase. - Do not shorten a single zero group with
::.
The IPv6 calculator expands and compresses addresses with these rules.
Prefixes and a /64 example
A prefix is the number of fixed leading bits. In 2001:db8:1234:5678:abcd::1/64, the first four groups form the prefix. The network is 2001:db8:1234:5678::/64, and the last value in the block is 2001:db8:1234:5678:ffff:ffff:ffff:ffff. IPv6 has no broadcast address; it uses unicast, anycast, and multicast.
Splitting a /56 into /64s
Extending /56 to /64 adds 8 subnet bits and creates 2^8 = 256 /64s. In order, 2001:db8:1200::/56 contains 2001:db8:1200::/64, 2001:db8:1200:1::/64, 2001:db8:1200:2::/64, through 2001:db8:1200:ff::/64.
The first three groups account for 48 fixed bits. A /56 also fixes the first 8 bits of the fourth group: 2001:0db8:1200:00xx. Only xx changes from 00 to ff: the remaining 8 bits of the fourth group. The third group stays 1200. The full block ends at 2001:db8:1200:ff:ffff:ffff:ffff:ffff. Do not apply the IPv4 subtraction rule: IPv6 does not use broadcast.
Address types and the IANA registry
| Range | Purpose |
|---|---|
::/128 | unspecified |
::1/128 | loopback |
fe80::/10 | link-local; routers do not forward it between links |
fc00::/7 | unique local; not globally routed |
ff00::/8 | multicast |
2001:db8::/32 and 3fff::/20 | documentation |
5f00::/16 | SRv6 SID space, not ordinary global host space |
::ffff:0:0/96 | IPv4-mapped addresses |
Classification must use the longest matching entry in the live IANA registry. An address beginning with 2 or 3 is not automatically ordinary global unicast.
RA, SLAAC, DHCPv6, and Neighbor Discovery
RA (Router Advertisement) is a message in Neighbor Discovery from RFC 4861. A router can use it to advertise a prefix, a default route, and configuration guidance. SLAAC (Stateless Address Autoconfiguration) in RFC 4862 lets a host form an address without a server assigning every address. DHCPv6 can supply addresses or other settings, but the default route normally still comes from RA. Neighbor Solicitation and Advertisement messages help find a device on the local link, check whether it is reachable, and detect duplicate addresses.
Link-local scope, DNS, and URLs
A link-local address may need a zone identifier such as fe80::1%eth0, because the same range exists on multiple interfaces. DNS stores IPv6 in AAAA records. An IPv6 literal in a URL needs brackets: https://[2001:db8::42]/; place a port after the closing bracket.
Checks that prevent common mistakes
- After expansion, count eight groups. Two
::abbreviations would be ambiguous, and zeroes may be removed only from the start of a group. - Choose the prefix for the use case. /64 is standard for many SLAAC subnets, while justified exceptions exist.
- Separate addressing from traffic protection. IPv6 does not need NAT for security; a firewall enforces policy, and a global address does not guarantee reachability.
- Use documentation ranges in examples and training, and use a properly assigned prefix in an operating network.