Guides · IP & network · Updated

IPv6 address format explained, with examples

An IPv6 address is 128 bits, written as eight groups of four hexadecimal digits separated by colons. Long runs of zeros can be shortened with a single ::. RFC 5952 recommends lower case, no leading zeros, and shortening the longest run of zeros. A full address and its shortened form mean exactly the same thing.

Check whether you have one

See whether your connection has a public IPv6 address:

The full form

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

Eight groups, each 16 bits, so 8 × 16 = 128 bits. Digits are 0 to 9 and a to f, and are case-insensitive. Lowercase is the recommended way to write them.

Shortening rules

  1. Drop leading zeros in each group: 0db8 becomes db8 and 0042 becomes 42.
  2. Replace the longest run of all-zero groups with ::. Use it only once, or the address would be ambiguous.
2001:0db8:0000:0000:0000:ff00:0042:8329
2001:db8:0:0:0:ff00:42:8329     (leading zeros dropped)
2001:db8::ff00:42:8329          (zero run replaced)
  • A single zero group is left as 0, not turned into ::.
  • If two runs are equally long, the first one is shortened.
  • The all-zero address is :: and the loopback address is ::1.

Valid and invalid examples

AddressValid?Why
2001:db8::1YesNormal shortened form.
fe80::1ff:fe23:4567:890aYesLink-local address.
2001:db8::1::2NoTwo :: in one address.
2001:db8:12345::1NoA group has more than four digits.
2001:db8:0:0:0:0:0:0:1NoNine groups.
2001:dg8::1Nog isn't a hex digit.

Prefixes you will see

PrefixMeaning
2000::/3Global unicast: normal public addresses, most start with 2 or 3.
fe80::/10Link-local: automatic, works only on the local network segment.
fc00::/7Unique local: private addresses, in practice starting fd.
::1/128Loopback, the machine itself.
2001:db8::/32Reserved for documentation and examples.
::ffff:192.0.2.1An IPv4 address carried inside IPv6 (IPv4-mapped).

Network and host parts

Like IPv4, an address splits into a network prefix and a host part, written with a slash: 2001:db8:abcd:12::/64. A /64 is the standard size of one network. Providers typically give homes a /56 or /60 and businesses a /48, so you can run many networks. Prefix arithmetic is covered in the subnetting cheat sheet.

In URLs and commands

  • URLs need square brackets: http://[2001:db8::1]:8080/.
  • Many tools take -6 to force IPv6, such as ping -6 and curl -6.
  • A link-local address needs the interface: fe80::1%eth0.

For how IPv6 differs from IPv4 overall, read IPv4 vs IPv6, and to check your own connection see how to test IPv6.

Frequently asked questions

How many bits is an IPv6 address?

128 bits, written as eight groups of four hexadecimal digits. An IPv4 address is 32 bits.

How do I shorten an IPv6 address?

Drop leading zeros in each group, then replace the longest run of all-zero groups with ::. You may use :: only once per address.

What is fe80 in an IPv6 address?

fe80::/10 is the link-local range. Every IPv6 interface has one automatically, and it works only on the local network segment, never across the internet.

What is ::1?

The loopback address, the IPv6 equivalent of 127.0.0.1. It always refers to the machine you are on.

Can I put an IPv6 address in a URL?

Yes, in square brackets, such as http://[2001:db8::1]:8080/. The brackets stop the colons being mistaken for a port separator.