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

# toNumber

```ts theme={null}
function toNumber(value): number
```

Converts `value` to a number. If `value` is a Uint8Array, it is treated as Big Endian data. Throws if the value is
not safe.

## Parameters

| Parameter | Type | Description |
| :- | :- | :- |
| `value` | `Uint8Array` \| [`BigNumberish`](https://docs.qu.ai/sdk/content/type-aliases/BigNumberish) | The value to convert. |

## Returns

`number`

The value.

## Throws

If the value is not safe to convert to a number.

## Source

[utils/maths.ts:243](https://github.com/dominant-strategies/quais.js/blob/c1c12d43f9d34c6baad2b0542bd6d0acd6fefcbf/src/utils/maths.ts#L243)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.