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

# Rlp.fromHex

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

Encodes a [`Hex.Hex`](/docs/utilities/hex/types#hex) value into a Recursive-Length Prefix (RLP) value.

## Imports

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

## Examples

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

Rlp.fromHex('0x68656c6c6f20776f726c64')
// @log: 0x8b68656c6c6f20776f726c64
```

## Definition

```ts
function fromHex<as>(
  hex: RecursiveArray<Hex.Hex>,
  options?: fromHex.Options<as>,
): fromHex.ReturnType<as>
```

## Parameters

### hex

* **Type:** `RecursiveArray<Hex.Hex>`

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

### options

* **Type:** `fromHex.Options<as>`
* **Optional**

Options.

#### options.as

* **Type:** `"Bytes" | "Hex" | as`

The type to convert the RLP value to.

## Return Type

The RLP value.

`fromHex.ReturnType<as>`
