> ## 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.toBigInt

> Convert Uint256 to JavaScript BigInt

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

<Tabs />

## Usage Patterns

### Arithmetic Operations

```typescript theme={null}
const a = Uint(100n)
const b = Uint(50n)

// Use BigInt for operations not supported by Uint
const bigIntA = Uint.toBigInt(a)
const bigIntB = Uint.toBigInt(b)

// Custom operation
const result = bigIntA ** 2n + bigIntB
const resultUint = Uint(result)
```

### Comparison with BigInt

```typescript theme={null}
const value = Uint(1000n)
const bigint = Uint.toBigInt(value)

if (bigint > 500n) {
  console.log("Greater than 500")
}
```

### JSON Serialization

```typescript theme={null}
const value = Uint(12345n)

// BigInt not supported in JSON.stringify
const json = JSON.stringify({
  balance: Uint.toBigInt(value).toString()  // Convert to string
})
```

## See Also

* [fromBigInt](/primitives/uint256/from-bigint) - Create from BigInt
* [toNumber](/primitives/uint256/to-number) - Convert to number
* [toString](/primitives/uint256/to-string) - Convert to string
