NetCalcLab

IPv6 Calculator

Expand, compress and analyse IPv6 addresses with exact 128-bit arithmetic. Get the network prefix, the first and last address in the range, the number of addresses and how many /64 networks fit inside — for prefixes from /0 to /128.

Accepts compressed form with ::, full 8-group form, embedded IPv4 such as ::ffff:192.168.1.1, and a zone index.

0 to 128. Overrides any /prefix typed in the address field.

Examples:

How an IPv6 address is structured

An IPv6 address is 128 bits, written as eight groups of four hexadecimal digits separated by colons. Each group is 16 bits, so 8 × 16 = 128. Unlike IPv4 there is no dotted-decimal alternative and no address classes.

Anatomy of an address
2001:0db8:1234:5678:9abc:def0:1234:5678
├──────────────┤├──────────────────────┤
   64 bits                 64 bits
   network prefix         interface identifier

2001:0db8:1234:5678 : 9abc:def0:1234:5678
└─ routing prefix ──┘ └── subnet ──┘
   48 bits              16 bits

In practice the network is split as a /48 assigned by the ISP, a /64 for each LAN, and the remaining 64 bits for hosts on that LAN. That gives 65,536 /64 networks from a single /48 — far more than any site needs, which is why ISPs hand out /48s as the standard business allocation.

The compression rules

IPv6 addresses are long, so two shorthands exist. Both are defined in RFC 4291 and refined in RFC 5952, which specifies the canonical form that this calculator produces.

  1. Drop leading zeros in each group. The group 0db8 becomes db8. A group of all zeros becomes a single 0 unless it is part of a compressed run.
  2. Replace one run of zero groups with ::. The run must be the longest available. If two runs are the same length, compress the first one.
  3. Never compress a single zero group. RFC 5952 requires that :: represent at least two groups, so 2001:db8:0:1::1 keeps its lone 0.

Example: 2001:0db8:0000:0000:0000:0000:0000:0001

Step 1 — drop leading zeros:

2001:db8:0:0:0:0:0:1

Step 2 — the longest zero run covers groups 3 to 7, which is five groups:

2001:db8::1

Expanding works in reverse: count the groups written (two) and the groups implied by :: (six), giving the full eight-group form.

Why prefix arithmetic needs 128-bit numbers

A /64 contains 2^64 addresses, which is 18,446,744,073,709,551,616. JavaScript numbers are IEEE 754 doubles and can only represent integers exactly up to 2^53, and JavaScript's bitwise operators work on 32 bits at a time. Any IPv6 calculator built on Number will silently return wrong values for large prefixes.

This calculator converts every address to a BigInt and performs the masking operations there, so a /0, a /64 and a /128 all return exact decimal counts. The address count for a /0 is displayed as a full 39-digit number rather than a rounded one.

Common IPv6 mistakes

  • Subnetting a LAN to anything other than /64. SLAAC breaks, privacy extensions stop working, and some operating systems simply refuse to configure an address.
  • Using two :: in one address. 2001::db8::1 is invalid because the parser cannot tell how many zero groups each compression stands for.
  • Planning for address conservation. A /64 per VLAN is the correct default. Trying to squeeze VLANs into a /120 to "save space" creates problems for no benefit.
  • Assuming a link-local address is routable. fe80::/10 never leaves the link, and it still needs a zone index such as fe80::1%eth0 to be unambiguous when a device has several interfaces.

IPv6 prefix sizes

Common IPv6 prefix lengths and what they are used for
PrefixAddresses/64 networksTypical use
/03.4 × 10^382^64Default route — the entire address space
/34.25 × 10^372^61Global unicast allocation (2000::/3)
/165.19 × 10^342^48Very large allocation to a registry
/327.9 × 10^282^32Standard ISP allocation — typically a /32 from a registry
/481.2 × 10^1565,536Standard site or business allocation (16 bits of subnetting)
/564.7 × 10^15256Standard residential allocation (8 bits of subnetting)
/641.8 × 10^191A single LAN segment — the required size for SLAAC
/11265,536—Sub-/64 prefix, only in specialised designs
/1281—A single interface or host route

IPv6 address types

IPv6 address type prefixes
PrefixTypeRoutable?Notes
::1/128LoopbackNoThe IPv6 equivalent of 127.0.0.1
::/128UnspecifiedNoSource address only, before configuration
2000::/3Global unicastYesThe only currently allocated global unicast range
2001:db8::/32DocumentationNoRFC 3849 — for examples and documentation only
fc00::/7Unique localNoRFC 4193 private space, analogous to RFC 1918
fe80::/10Link-localNoAuto-configured on every interface, never routed
ff00::/8MulticastNoReplaces IPv4 broadcast entirely
2002::/166to4DeprecatedTransition mechanism, no longer recommended
::ffff:0:0/96IPv4-mappedInternalRepresents an IPv4 peer on a dual-stack socket
64:ff9b::/96NAT64YesRFC 6052 well-known translation prefix

For a longer explanation of each address type and when to use it, see the IPv6 address types guide.

Frequently asked questions

How do I expand an IPv6 address?

Replace the :: with enough zero groups to reach eight groups total, then pad each group to four hexadecimal digits. For 2001:db8::1 there are two groups written and one :: standing for six groups, so the expanded form is 2001:0db8:0000:0000:0000:0000:0000:0001.

How do I compress an IPv6 address?

Remove leading zeros from every group, and replace the longest run of consecutive all-zero groups with ::. Only one :: may be used per address, because two would be ambiguous. RFC 5952 also says a single zero group should not be compressed, so 2001:db8:0:1::1 keeps the single zero group written out.

Why is a /64 the standard IPv6 subnet size?

Stateless Address Autoconfiguration builds an interface identifier from the 64 low-order bits, so a device needs a /64 to auto-configure. Router Advertisement on a /64 also lets hosts use the full 64-bit identifier space, which is what privacy extensions rely on. Using anything other than /64 on a LAN breaks these mechanisms.

How many addresses are in an IPv6 /64?

2^64, which is 18,446,744,073,709,551,616 addresses — roughly 4.3 billion times the entire IPv4 address space. That count cannot be represented exactly by a JavaScript Number, which is why all the arithmetic on this page uses BigInt.

What is the difference between :: and 0:0:0:0:0:0:0:0?

They are the same address, just written differently. :: is the unspecified address, used only as a source address before an interface has been assigned one. It must never be used as a destination.

What does an IPv4-mapped IPv6 address look like?

An IPv4-mapped address is written ::ffff:a.b.c.d, for example ::ffff:192.168.1.1. The first 80 bits are zero, the next 16 are ones, and the final 32 bits carry the IPv4 address. These appear when a dual-stack socket represents an IPv4 peer, and they are different from the deprecated IPv4-compatible ::a.b.c.d form.

How much of the IPv6 address space is actually used for global unicast?

Global unicast addresses are allocated from 2000::/3, which is only one eighth of the total address space. Addresses starting with 000 are reserved and not currently used for unicast at all, leaving room for future expansion.