> **Can't find what you're looking for?** Use `search_docs` on the docs MCP server at `https://v3.viem.sh/api/mcp` to find what you need.

# Hex.padLeft

:::info
`Hex.padLeft` is a re-export of ox's [`Hex.padLeft`](https://oxlib.sh/api/Hex/padLeft). Refer to the ox documentation for the full reference.
:::

Pads a [`Hex.Hex`](/docs/utilities/hex/types#hex) value to the left with zero bytes until it reaches the given `size` (default: 32 bytes).

## Imports

```ts
import { Hex } from 'viem/utils'
```

## Examples

```ts twoslash
// @noErrors
import { Hex } from 'viem/utils'

Hex.padLeft('0x1234', 4)
// @log: '0x00001234'
```

## Definition

```ts
function padLeft(
  value: Hex,
  size?: number,
): padLeft.ReturnType
```

## Parameters

### value

* **Type:** `Hex`

The [`Hex.Hex`](/docs/utilities/hex/types#hex) value to pad.

### size

* **Type:** `number`
* **Optional**

The size (in bytes) of the output hex value.

## Return Type

The padded [`Hex.Hex`](/docs/utilities/hex/types#hex) value.

`padLeft.ReturnType`
