Skip to content

Main content

IPv6 Prefix Subnet ID Field Tool

Compute ipv6 prefix subnet id field from explicit bounded inputs.

Loading tool…

Description

Extract the bits between globalPrefixLength and subnetPrefixLength with exact integer shifts and masking, returning subnetId as decimal text and the field width.

A network prefix divides an address into higher prefix bits and lower address bits. Zone labels and textual address tokens introduce separate representation rules.

Extract the bits between globalPrefixLength and subnetPrefixLength with exact integer shifts and masking, returning subnetId as decimal text and the field width.

When to use this tool

Use IPv6 Prefix Subnet ID Field when you need a prefix-field calculation or a controlled address-token split.

How to use the tool and how it works

  1. Enter addressHex, globalPrefixLength, subnetPrefixLength. Use the units and conventions below.
  2. Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
  3. Read subnetId, bits. Use the output convention below.

Require exactly 32 hexadecimal digits. Extract the bits between globalPrefixLength and subnetPrefixLength with exact integer shifts and masking, returning subnetId as decimal text and the field width.1

Input fieldMeaning and unitsAccepted input
addressHexAddress HexRequired. Text; maximum UTF-16 length 8192.
globalPrefixLengthGlobal Prefix LengthRequired. Safe integer; minimum 0; maximum 128.
subnetPrefixLengthSubnet Prefix LengthRequired. Safe integer; maximum 128.
Output fieldInterpretationReturned shape
subnetIdSubnet IdRequired. Text; maximum UTF-16 length 8192.
bitsBitsRequired. Safe integer.
json
{
  "input": {
    "addressHex": "20010db8abcd00120000000000000001",
    "globalPrefixLength": 48,
    "subnetPrefixLength": 64
  },
  "output": {
    "subnetId": "18",
    "bits": 16
  }
}

Limitations and assumptions

  • Colon notation is not accepted; a zero-width field returns zero and no address allocation is verified.
  • Inputs must satisfy both the field types and the cross-field conditions above. Invalid input causes an error; a successful false flag or documented placeholder is a different result.
  • Numeric calculations use binary floating point unless exact decimal-integer arithmetic is explicitly stated. No hidden measurement tolerance or decimal rounding is added; nonfinite or out-of-contract results are rejected. Numeric signed-zero results are exported as zero.

Alternative or Complementary methods

Use a full address parser and the relevant allocation or interface metadata to validate actual addressing.

References

  1. Calculation and input contract: network/ipv6-prefix-subnet-id-field — tool.io

Similar or alternative tools