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

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

Encodes a [`Bytes.Bytes`](/docs/utilities/bytes/types#bytes) 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.fromBytes(
  Bytes.from([
    139, 104, 101, 108, 108, 111, 32, 119, 111, 114, 108,
    100
  ])
)
// @log: Uint8Array([104, 101, 108, 108, 111,  32, 119, 111, 114, 108, 100])
```

## Definition

```ts
function fromBytes<as>(
  bytes: RecursiveArray<Bytes.Bytes>,
  options?: fromBytes.Options<as>,
): fromBytes.ReturnType<as>
```

## Parameters

### bytes

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

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

### options

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

Options.

#### options.as

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

The type to convert the RLP value to.

## Return Type

The RLP value.

`fromBytes.ReturnType<as>`
