Skip to content
Generate now

IPv6 Address Notation Explained: Rules and Ranges

IPv6 addresses look intimidating: eight blocks of hex, colons everywhere, and sometimes a mysterious double colon that swallows half the address. Yet the rules behind them are short and logical. Once you know how compression works and which prefixes signal special ranges, you can read logs faster, write better validation code and build test data that actually exercises the edge cases your parser will meet in production.

Options

Tip: press Enter or Space to generate again.

Ready

The anatomy of an IPv6 address

An IPv6 address is 128 bits, written as eight groups of 16 bits. Each group is four hexadecimal digits, separated by colons:

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

In a typical global unicast address, the first 64 bits are the network prefix (assigned by a provider and divided into subnets) and the last 64 bits are the interface identifier that names a single device on that subnet. That split is why you so often see /64 after IPv6 networks.

Shortening rules: leading zeros and the double colon

Two rules make addresses shorter:

  1. Drop leading zeros in any group: 0db8 becomes db8, 0042 becomes 42, and 0000 becomes 0.
  2. Replace one run of all-zero groups with ::. It may appear only once, otherwise the address would be ambiguous.

Applied to the example above, you get 2001:db8::ff00:42:8329. The recommended text format (RFC 5952) adds a few conventions: use lowercase letters, compress the longest run of zero groups, and do not use :: for a single zero group. Following these makes addresses easy to compare as plain strings.

Two more notations to know: in URLs, an IPv6 address goes in square brackets so the port is not confused with a group, as in [2001:db8::1]:8080; and a % suffix such as fe80::1%eth0 names the network interface for link-local addresses.

Prefixes that tell you what an address is

The first few hex digits reveal the address type:

  • ::1 โ€” loopback, the IPv6 version of 127.0.0.1.
  • :: โ€” the unspecified address, used before a device has one.
  • 2000::/3 โ€” global unicast, the publicly routable space (addresses starting with 2 or 3).
  • fc00::/7 โ€” unique local addresses for private networks; in practice they start with fd.
  • fe80::/10 โ€” link-local, valid only on a single network segment.
  • ff00::/8 โ€” multicast.
  • 2001:db8::/32 โ€” reserved for documentation and examples.

If you publish addresses in manuals or tutorials, the documentation range is the safe choice because it will never be routed on the internet.

Creating IPv6 test data with RandNow

Hand-typing 128-bit addresses is slow and error-prone. The Random IPv6 Address Generator does it for you:

  1. Open the tool; IPv6 is already selected in the Version menu.
  2. Set the Range to Public for globally routable-style addresses starting with 2, or Private (LAN) for internal network addresses.
  3. Choose how many you need, up to 100 per batch, and generate.
  4. Switch the Version menu to IPv4 when your test also needs dotted-quad addresses, then export everything as CSV, JSON or TXT.

Public results are not checked against real assignments, so use them for parsers, logs and forms โ€” never to probe real hosts.

Edge cases your parser should handle

  • The same address written in full, compressed and uppercase forms โ€” they must compare as equal.
  • Invalid input with two :: sequences or a group longer than four digits.
  • IPv4-mapped addresses such as ::ffff:192.0.2.1.
  • Addresses with zone IDs and bracketed addresses with ports.
  • CIDR notation like 2001:db8::/48 in firewall rules and allow-lists.

Feed generated addresses through your code, normalize them, and check that storing and reading back never changes the value.

Why IPv6 needed such long addresses

IPv4 offers about 4.3 billion addresses, which seemed generous in the early 1980s but ran short as phones, laptops, servers and smart devices multiplied. Tricks such as network address translation stretched the supply, at the cost of extra complexity. IPv6 was designed in the 1990s to remove the shortage for good: 128 bits give roughly 340 undecillion addresses, enough to hand every subnet its own vast block.

That abundance changes everyday habits. Home networks usually receive a whole /64 or more, devices can configure their own addresses automatically, and many operating systems rotate temporary addresses for privacy. For developers, it means logs contain far more unique addresses, so storage, indexing and anonymization need planning from the start.

Pro tips

  • Normalize every address to the RFC 5952 form before storing or comparing it.
  • Use your languageโ€™s built-in IP parsing library instead of a hand-written regular expression.
  • Make database columns wide enough for the full 39-character form, plus zone IDs if you log them.
  • Use the 2001:db8::/32 range in screenshots and documentation.

Frequently asked questions

Why can the double colon appear only once?

If two runs of zeros were both compressed, there would be no way to tell how many zero groups each one stands for, so the address would be ambiguous.

Is IPv6 case-sensitive?

No. Hex digits can be upper or lower case, but lowercase is the recommended text form, so normalize before comparing strings.

What does /64 mean after an IPv6 address?

It is the prefix length: the first 64 bits identify the network, and the remaining 64 bits identify a device on it. A /64 is the standard size for a single subnet.

Try a generator

Random Address Generator

Realistic street addresses with valid-format postal codes and phone numbers for 40 countries.

Fake Identity Generator

Complete fictional person profiles: name, birthday, address, phone, email, job and more.

Need random data? Get it now.

Pick any of 144 generators, hit Generate and copy or export the results as CSV, JSON or TXT. No account, no limits, nothing stored.

Start generating โ€” free