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

# toBeHex

```ts theme={null}
function toBeHex(_value, _width?): string
```

Converts `value` to a Big Endian hexstring, optionally padded to `width` bytes.

## Parameters

| Parameter | Type                                                     | Description                      |
| :-------- | :------------------------------------------------------- | :------------------------------- |
| `_value`  | [`BigNumberish`](/sdk/content/type-aliases/BigNumberish) | The value to convert.            |
| `_width`? | [`Numeric`](/sdk/content/type-aliases/Numeric)           | The width of the value in bytes. |

## Returns

`string`

The hexstring.

## Throws

If the value exceeds the width.

## Source

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