> ## Documentation Index
> Fetch the complete documentation index at: https://voltaire.tevm.sh/llms.txt
> Use this file to discover all available pages before exploring further.

# Uint.bitLength

> Get number of bits required to represent Uint256 value

<Card title="Try it Live" icon="play" href="https://playground.tevm.sh?example=primitives/uint.ts">
  Run Uint examples in the interactive playground
</Card>

## `Uint.bitLength(value: BrandedUint256): number`

Get number of bits required to represent value (position of highest set bit + 1).

**Parameters:**

* `value: BrandedUint256` - Value to measure

**Returns:** `number` - Bit length (0-256)

**Example:**

```typescript theme={null}
import { Uint } from 'tevm'

Uint.bitLength(Uint(0n))     // 0
Uint.bitLength(Uint(1n))     // 1
Uint.bitLength(Uint(2n))     // 2
Uint.bitLength(Uint(255n))   // 8
Uint.bitLength(Uint(256n))   // 9
Uint.bitLength(Uint.MAX)          // 256
```

**Defined in:** [primitives/Uint/bitLength.ts](https://github.com/evmts/voltaire/blob/main/src/primitives/Uint/bitLength.ts)

## See Also

* [leadingZeros](/primitives/uint256/leading-zeros) - Count leading zero bits
* [popCount](/primitives/uint256/pop-count) - Count set bits
