opyebCidrPlan

IPv6 notation and exact 128-bit arithmetic

IPv6 · 7 min read

In one line: Eight groups, :: compression and RFC 5952, why /64 is the standard subnet, and the Subnet-Router anycast that replaces broadcast.

An IPv6 address is 128 bits, written as eight colon-separated groups of 16 bits. The full form of a host address looks like 2001:0db8:0000:0000:0000:0000:0000:0001. Two compressions make it readable.

RFC 5952 compression

  • Drop leading zeros in every group: 0db8 becomes db8.
  • Replace one run of consecutive zero groups with ::. Choose the longest run; if two runs tie, choose the leftmost.
  • :: may appear only once. Twice makes the original address impossible to rebuild.
  • Use lowercase hex digits.
full:      2001:0db8:0000:0000:0000:0000:0000:0001
compressed: 2001:db8::1
full:      2001:0db8:0000:0001:0000:0000:0000:0001
compressed: 2001:db8:0:1::1      ← only the longest zero run is compressed
invalid:    2001:db8::1::2       ← :: cannot appear twice

Why /64 is the standard

IPv6 subnets are normally /64: 64 host bits remain so SLAAC (Stateless Address Autoconfiguration) can build an interface identifier on its own. Clouds follow the same rule. Azure requires IPv6 subnets to be exactly /64, and AWS accepts /44 to /60 for a VPC and /44 to /64 for subnets in 4-bit steps.

PrefixAddressesEqual subnetsTypical use
/322⁹⁶65,536 /48sISP or organisation
/482⁸⁰65,536 /64sa site
/562⁷²256 /64shome or small office
/642⁶⁴1one subnet

The numbers are too large to picture, but the arithmetic is easy: every 8 bits of prefix multiplies the subnet count by 256.

No broadcast, but an anycast address

IPv6 uses multicast instead of broadcast, so the last address of a subnet is not reserved. Instead the all-zero address of every subnet is the Subnet-Router anycast address (RFC 4291). That is why CidrPlan shows usable as total − 1 for IPv6; every other address can belong to a host.

Doing 128 bits exactly

JavaScript's bitwise operators (&, |, >>) work on signed 32-bit integers. Using them on an IPv6 address silently truncates the upper bits. CidrPlan converts every address to BigInt before applying masks and only converts back for display in RFC 5952 form.

2001:db8::/48  network   2001:db8:0:0:0:0:0:0
               mask      ffff:ffff:ffff:0:0:0:0:0
               last      2001:db8:0:ffff:ffff:ffff:ffff:ffff
               subnets   65,536 /64 blocks

Run the same calculation with 32-bit operators and ffff:ffff:... reads as a negative number, quietly turning the broadcast into zero. The larger the numbers, the more the internal representation matters.

Everything is calculated in your browser. The ranges you type are not stored on a server.

Back to the CIDR calculator

Frequently asked questions

What subnet size is standard in IPv6?

/64. It leaves 64 host bits for SLAAC, and most clouds require it.

Can :: appear more than once?

No. Only once per address; with two occurrences the number of zero groups in each is ambiguous.

Does IPv6 have a broadcast address?

No. It uses multicast, and the all-zero address of each subnet is reserved as the Subnet-Router anycast.

Sources

Read next