# Rlp.from

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

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>
```

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

## Parameters

### value

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

The [`Bytes.Bytes`](/api/Bytes/types#bytes) or [`Hex.Hex`](/api/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>`
