Compress an IPv6 address with two equal zero runs

Convert a full eight-hextet IPv6 address to RFC 5952 notation and normalize the same address to its /64 network.

Try these inputs

Worked calculation

  1. Remove leading zeros from each hextet. The sequence becomes 2001:db8:0:0:20:0:0:42.
  2. The two zero runs each have length two. Compress the leftmost to obtain 2001:db8::20:0:0:42.
  3. A /64 retains the first four hextets and zeroes the last four, so the network reads 2001:db8::/64.

Inputs

Prefix lengths
Zero-based. The first child has index 0.

Calculated in your browser

Results

Selected child
2001:db8::/64
Selected leaf
2001:db8::/64
Child prefixes
1

IPv6 prefix tree

IPv6 prefix treeThe parent connects to nearby child prefixes. The selected child connects to nearby leaf prefixes. Full CIDRs and indices appear in the table.2001:db8::/642001:db8::/642001:db8::/642001:db8::/642001:db8::/642001:db8::/64/64 → /64 → /64
  • Selected prefix
  • Nearby or parent prefix
The parent connects to nearby child prefixes. The selected child connects to nearby leaf prefixes. Full CIDRs and indices appear in the table.
Parent network
2001:db8::/64
Last address in parent
2001:db8::ffff:ffff:ffff:ffff
Full address
2001:0db8:0000:0000:0020:0000:0000:0042
Compressed address
2001:db8::20:0:0:42
Addresses in parent
18,446,744,073,709,551,616
Leaves in selected child
1
Address space
IPv6
Prefixes near the selected indices
LevelIndexPrefixSelection
Child02001:db8::/64Selected
Leaf02001:db8::/64Selected

Questions

Would 2001:db8:0:0:20::42 identify the same numeric address?

Yes. The RFC 5952 canonical representation chooses the leftmost equal-length run, so it prints differently.

Can two double colons appear in one address?

The syntax uses at most one ::. Otherwise the number of omitted hextets would be ambiguous.

References