# Bech32m.encode

Encodes data bytes with a human-readable part (HRP) into a bech32m string (BIP-350).

## Imports

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

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

## Examples

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

const encoded = Bech32m.encode('tempo', new Uint8Array(20))
// @log: 'tempo1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqwa7xtm'
```

## Definition

```ts
function encode(
  hrp: string,
  data: Uint8Array,
  options?: encode.Options,
): string
```

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

## Parameters

### hrp

* **Type:** `string`

The human-readable part (e.g. `"tempo"`, `"tempoz"`).

### data

* **Type:** `Uint8Array`

The data bytes to encode.

### options

* **Type:** `encode.Options`
* **Optional**

#### options.limit

* **Type:** `number`
* **Optional**

Maximum length of the encoded string.

## Return Type

The bech32m-encoded string.

`string`
