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

# toQuantity

```ts theme={null}
function toQuantity(value): string
```

Returns a `HexString` for `value` safe to use as a Quantity.

A Quantity does not have and leading 0 values unless the value is the literal value `0x0`. This is most commonly used
for JSSON-RPC numeric values.

## Parameters

| Parameter | Type                                             | Description           |
| :-------- | :----------------------------------------------- | :-------------------- |
| `value`   | `string` \| `number` \| `bigint` \| `Uint8Array` | The value to convert. |

## Returns

`string`

The quantity.

## Source

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