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

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

Encodes a [`Bytes.Bytes`](/docs/utilities/bytes/types#bytes) or [`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 { Bytes, Rlp } from 'viem/utils'

Rlp.from('0x68656c6c6f20776f726c64', { as: 'Hex' })
// @log: 0x8b68656c6c6f20776f726c64

Rlp.from(
  Bytes.from([
    139, 104, 101, 108, 108, 111, 32, 119, 111, 114, 108,
    100
  ]),
  { as: 'Bytes' }
)
// @log: Uint8Array([104, 101, 108, 108, 111,  32, 119, 111, 114, 108, 100])
```

## Definition

```ts
function from<as>(
  value: RecursiveArray<Bytes.Bytes> | RecursiveArray<Hex.Hex>,
  options: from.Options<as>,
): from.ReturnType<as>
```

## Parameters

### value

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

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

### options

* **Type:** `from.Options<as>`

Options.

#### options.as

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

The type to convert the RLP value to.

## Return Type

The RLP value.

`from.ReturnType<as>`
