Skip to content

Main content

IPv6 Prefix Host Bit Count Tool

Count address bits and all bit patterns within an IPv6 prefix without subtracting network or broadcast addresses.

Loading tool…

Description

Subtract prefixLength from 128 and calculate 2 raised to that host-bit count using exact integers.

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

Subtract prefixLength from 128 and calculate 2 raised to that host-bit count using exact integers.

When to use this tool

Use IPv6 Prefix Host Bit Count when you need a prefix-field calculation or a controlled address-token split.

How to use the tool and how it works

  1. Enter prefixLength. 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 hostBits, addressCountDecimal. Use the output convention below.

Subtract prefixLength from 128 and calculate 2 raised to that host-bit count using exact integers. Return the count as decimal text.1

Input fieldMeaning and unitsAccepted input
prefixLengthPrefix LengthRequired. Safe integer; minimum 0; maximum 128.
Output fieldInterpretationReturned shape
hostBitsHost BitsRequired. Safe integer.
addressCountDecimalAddress Count DecimalRequired. Text; maximum UTF-16 length 8192.
json
{
  "input": {
    "prefixLength": 64
  },
  "output": {
    "hostBits": 64,
    "addressCountDecimal": "18446744073709551616"
  }
}

Limitations and assumptions

  • Address count is a mathematical prefix size, not a count of reachable or assignable hosts.
  • 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-host-bit-count — tool.io

Similar or alternative tools

  • IPv6 Prefix Subnet ID Field

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

  • IPv6 Zone Token Splitter

    Split the unbracketed literal at its sole percent sign.