# Rlp.fromHex

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

## Imports

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

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

## Examples

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

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

## Definition

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

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

## Parameters

### hex

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

The [`Hex.Hex`](/api/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>`
