[API reference](https://evolu.dev/docs/api-reference) › [@evolu/common](https://evolu.dev/docs/api-reference/common) › [Buffer](https://evolu.dev/docs/api-reference/common/Buffer) › utf8ToBytes

```ts
function utf8ToBytes(
  str: string,
): Uint8Array<ArrayBufferLike> & Uint8Array<ArrayBuffer>;
```

Defined in: node\_modules/@noble/ciphers/utils.d.ts:361

Converts string to bytes using UTF8 encoding.

## Throws

On wrong argument types. [TypeError](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypeError)

## Example

Encodes application text before encryption or MACing.

```ts
utf8ToBytes("abc"); // new Uint8Array([97, 98, 99])
```