An Internet Protocol version 6 address (IPv6 address) is a numeric label that is used to identify and locate a network interface of a computer or a network node participating in a computer network using IPv6. IP addresses are included in the packet header to indicate the source and the destination of each packet. The IP address of the destination is used to make decisions about routing IP packets to other networks.

IPv6 is the successor to the first addressing infrastructure of the Internet, Internet Protocol version 4 (IPv4). In contrast to IPv4, which defined an IP address as a 32-bit value, IPv6 addresses have a size of 128 bits. Therefore, in comparison, IPv6 has a vastly enlarged address space.

Addressing methods IPv6 addresses are classified by the primary addressing and routing methodologies common in networking: unicast addressing, anycast addressing, and multicast addressing.

A unicast address identifies a single network interface. The Internet Protocol delivers packets sent to a unicast address to that specific interface.

An anycast address is assigned to a group of interfaces, usually belonging to different nodes. A packet sent to an anycast address is delivered to just one of the member interfaces, typically the nearest host, according to the routing protocol's definition of distance. Anycast addresses cannot be identified easily; they have the same format as unicast addresses and differ only by their presence in the network at multiple points. Almost any unicast address can be employed as an anycast address.

A multicast address is also used by multiple hosts that acquire the multicast address destination by participating in the multicast distribution protocol among the network routers. A packet that is sent to a multicast address is delivered to all interfaces that have joined the corresponding multicast group. IPv6 does not implement broadcast addressing. Broadcast's traditional role is subsumed by multicast addressing to the all-nodes link-local multicast group . However, the use of the all-nodes group is not recommended, and most IPv6 protocols use protocol-specific link-local multicast groups to avoid disturbing every interface on a given network.

Address formats An IPv6 address consists of 128 bits. For each of the major addressing and routing methodologies, various address formats are recognized by dividing the 128 address bits into bit groups and using established rules for associating the values of these bit groups with special addressing features.

Unicast and anycast address format

Unicast and anycast addresses are typically composed of two logical parts: a 64-bit network prefix used for routing, and a 64-bit interface identifier used to identify a host's network interface. + General unicast address format (routing prefix size varies)bits 48 (or more) 16 (or fewer) 64field routing prefix subnet ID interface identifier

The network prefix (the routing prefix combined with the subnet ID) is contained in the most significant 64 bits of the address. The size of the routing prefix may vary; a larger prefix size means a smaller subnet ID size. The bits of the subnet ID field are available to the network administrator to define subnets within the given network. The 64-bit interface identifier is automatically established randomly, obtained from a DHCPv6 server, or assigned manually. (Historically, it was automatically generated from the interface's MAC address using the modified EUI-64 format, but this method is now not recommended for privacy reasons.)

Unique local addresses are addresses analogous to IPv4 private network addresses.

+ Unique local address formatbits 7 1 40 16 64field prefix L random subnet ID interface identifierThe prefix field contains the binary value 1111110. The L bit is one for locally assigned addresses; the address range with L set to zero is currently not defined. The random field is chosen randomly once, at the inception of the routing prefix.

A link-local address is also based on the interface identifier, but uses a different format for the network prefix.

+ Link-local address formatbits 10 54 64field prefix zeroes interface identifier The prefix field contains the binary value 1111111010. The 54 zeroes that follow make the total network prefix the same for all link-local addresses ( link-local address prefix), rendering them non-routable.

Multicast address format

Multicast addresses are formed according to several specific formatting rules, depending on the application.

+ General multicast address formatbits 8 4 4 112field prefix flg sc group ID

For all multicast addresses, the prefix field holds the binary value 11111111.

Currently, three of the four flag bits in the flg field are defined; the most-significant flag bit is reserved for future use.

+Multicast address flagsbitflagMeaning when 0Meaning when 18reservedreservedreserved9R (Rendezvous)Rendezvous point not embeddedRendezvous point embedded10P (Prefix)Without prefix informationAddress based on network prefix11T (Transient)Well-known multicast addressDynamically assigned multicast address

The four-bit scope field (sc) is used to indicate where the address is valid and unique.

In addition, the scope field is used to identify special multicast addresses, like solicited node.

+ Solicited-node multicast address formatbits 8 4 4 79 9 24field prefix flg sc zeroes ones unicast address

The sc(ope) field holds the binary value 0010 (link-local). Solicited-node multicast addresses are computed as a function of a node's unicast or anycast addresses. A solicited-node multicast address is created by copying the last 24 bits of a unicast or anycast address to the last 24 bits of the multicast address.

+ Unicast-prefix–based multicast address formatbits 8 4 4 4 4 8 64 32field prefix flg sc res riid plen network prefix group ID

Link-scoped multicast addresses use a comparable format.

Representation An IPv6 address is represented as eight groups of four hexadecimal digits, each group representing 16 bits The groups are separated by colons (:). An example of an IPv6 address is:

The standards provide flexibility in the representation of IPv6 addresses. The full representation of eight four-digit groups may be simplified by several techniques, eliminating parts of the representation. In general, representations are shortened as much as possible. However, this practice complicates several common operations, namely searching for a specific address or an address pattern in text documents or streams, and comparing addresses to determine equivalence. For mitigation of these complications, the Internet Engineering Task Force (IETF) has defined a canonical format for rendering IPv6 addresses in text: The hexadecimal digits are always compared in a case-insensitive manner, but IETF recommendations suggest the use of only lower case letters. For example, 2001:db8::1 is preferred over 2001:DB8::1; Leading zeros in each 16-bit field are suppressed, but each group must retain at least one digit. For example, is rendered as ; The longest sequence of consecutive all-zero fields is replaced with two colons (::). If the address contains multiple runs of all-zero fields of the same size, to prevent ambiguities, it is the leftmost that is compressed. For example, is rendered as rather than as . :: is not used to represent just a single all-zero field. For example, is shortened to , but is rendered as .

These methods can lead to very short representations for IPv6 addresses. For example, the localhost (loopback) address, , and the IPv6 unspecified address, , are reduced to and , respectively.

During the transition of the Internet from IPv4 to IPv6, it is typical to operate in a mixed addressing environment. For such use cases, a special notation has been introduced, which expresses IPv4-mapped and IPv4-compatible IPv6 addresses by writing the least-significant 32 bits of an address in the familiar IPv4 dot-decimal notation, whereas the 96 most-significant bits are written in IPv6 format. For example, the IPv4-mapped IPv6 address is written as , thus expressing clearly the original IPv4 address that was mapped to IPv6.

Networks An IPv6 network uses an address block that is a contiguous group of IPv6 addresses of a size that is a power of two. The leading set of bits of the addresses are identical for all hosts in a given network, and are called the network's address or routing prefix.

Network address ranges are written in CIDR notation. A network is denoted by the first address in the block (ending in all zeroes), a slash (/), and a decimal value equal to the size in bits of the prefix. For example, the network written as starts at address and ends at .

The routing prefix of an interface address may be directly indicated with the address using CIDR notation. For example, the configuration of an interface with address connected to subnet is written as .

Address block sizes The size of a block of addresses is specified by writing a slash (/) followed by a number in decimal whose value is the length of the network prefix in bits. For example, an address block with 48 bits in the prefix is indicated by . Such a block contains 2128 − 48 = 280 addresses. The smaller the length of the network prefix, the larger the block: a block is 8 times larger than a block.

Literal IPv6 addresses in network resource identifiers Colon (:) characters in IPv6 addresses may conflict with the established syntax of resource identifiers, such as URIs and URLs. The colon is conventionally used to terminate the host path before a port number. To alleviate this conflict, literal IPv6 addresses are enclosed in square brackets in such resource identifiers, for example:

When the URL also contains a port number the notation is:

where the trailing 443 is the example's port number.

Scoped literal IPv6 addresses (with zone index) For addresses with other than global scope (as described in ), and in particular for link-local addresses, the choice of the network interface for sending a packet may depend on which zone the address belongs to. The same address may be valid in different zones, and in use by a different host in each of those zones. Even if a single address is not in use in different zones, the address prefixes for addresses in those zones may still be identical, which makes the operating system unable to select an outgoing interface based on the information in the routing table (which is prefix-based).

In order to resolve the ambiguity in textual addresses, a must be appended to the address. The zone index is separated from the address by a percent sign (%). Although numeric zone indices must be universally supported, the zone index may also be an implementation-dependent string. The link-local address

could be expressed by

or

The former (using an interface name) is customary on most Unix-like operating systems (e.g., BSD, Linux, macOS). "The KAME implementation supports an extended numeric IPv6 address notation for link-local addresses, like "fe80::1%de0" [...] draft-ietf-ipngwg-scopedaddr-format-02.txt" The latter (using an interface number) is the only syntax on Microsoft Windows, but as support for this syntax is mandatory per standard, it is also available on other operating systems.

BSD-based operating systems (including macOS) also support an alternative, non-standard syntax, where a numeric zone index is encoded in the second 16-bit word of the address. E.g.:

In all operating systems mentioned above, the zone index for link-local addresses actually refers to an interface, not to a zone. As multiple interfaces may belong to the same zone (e.g. when connected to the same network), in practice two addresses with different zone identifiers may actually be equivalent, and refer to the same host on the same link.

When used in uniform resource identifiers (URI), the use of the percent sign causes a syntax conflict, therefore it must be escaped via percent-encoding, e.g.: