Practical developer guides
IPv6 prefixes: compression and subnet boundaries
Expand equivalent IPv6 notation and mask bits rather than comparing textual prefixes.
Expand equivalent spellings
Double-colon compresses one sequence of zero groups and may appear only once in an address. Leading zeros in groups can also be omitted.
Different strings can therefore represent the same 128-bit address. Compare parsed addresses, not display text.
2001:db8::1
2001:0db8:0000:0000:0000:0000:0000:0001
Same address.Apply the prefix mask
A /64 fixes the first 64 bits, not the first few characters of a compressed string. Host bits belong to the remaining 64 bits.
Use the subnet calculator to normalize the network and inspect its endpoints. String startsWith is not a subnet membership test.
2001:db8:1234:5678::/64
Inside: 2001:db8:1234:5678::abcd
Outside: 2001:db8:1234:5679::1Do not subtract IPv4 broadcast addresses
IPv6 does not use an IPv4-style broadcast address. A 128-p address count does not need the same blanket subtract-two formula.
Operational allocation can still reserve addresses or impose subnet policies. Check the actual deployment rather than calling every numeric address usable.
Handle URI brackets and zone identifiers
An IPv6 literal in a URL authority needs brackets to separate it from a port. Link-local addresses can also need an interface zone identifier.
Those are surrounding syntax and scope details, not changes to the subnet bits. Use documentation prefix 2001:db8::/32 in public fixtures.