The full format #
An IPv6 address is 128 bits long. It is written as 8 groups of 4 hexadecimal digits (0-9 and a-f), separated by colons. For example:
2001:0db8:0000:0000:0000:ff00:0042:8329
Rule 1: remove leading zeros #
In each group you can drop the zeros at the start. The address above becomes:
2001:db8:0:0:0:ff00:42:8329
Rule 2: replace consecutive zero groups with :: #
One run of groups that are all zero can be replaced with a double colon:
2001:db8::ff00:42:8329
You can use :: only once in an address; otherwise it would be impossible to know how many groups each one replaces.
Common examples #
::1is the loopback address, the IPv6 version of 127.0.0.1.::means an unspecified address (all zeros).fe80::/10addresses are link-local, used only inside a local network.
Writing IPv6 in a URL #
Because colons are also used for ports, put an IPv6 address in square brackets in a URL: http://[2001:db8::1]:8080/.
What does /64 mean? #
The number after the slash is the prefix length: 2001:db8::/64 means the first 64 bits identify the network and the remaining 64 bits identify devices in it.
Want to understand how the two versions compare? Read IPv4 vs IPv6: key differences.