# Hex.toString

Decodes a [`Hex.Hex`](/api/Hex/types#hex) value into a string.

## Imports

:::code-group
```ts [Named]
import { Hex } from 'ox'
```

```ts [Entrypoint]
import * as Hex from 'ox/Hex'
```
:::

## Examples

```ts twoslash
import { Hex } from 'ox'

Hex.toString('0x48656c6c6f20576f726c6421')
// @log: 'Hello world!'

Hex.toString(
  '0x48656c6c6f20576f726c64210000000000000000000000000000000000000000',
  {
    size: 32
  }
)
// @log: 'Hello world'
```

## Definition

```ts
function toString(
  hex: Hex,
  options?: toString.Options,
): string
```

**Source:** [src/core/Hex.ts](https://github.com/wevm/ox/blob/main/src/core/Hex.ts#L1003)

## Parameters

### hex

* **Type:** `Hex`

The [`Hex.Hex`](/api/Hex/types#hex) value to decode.

### options

* **Type:** `toString.Options`
* **Optional**

Options.

#### options.size

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

Size (in bytes) of the hex value.

## Return Type

The decoded string.

`string`
