> ## Documentation Index
> Fetch the complete documentation index at: https://bun.manicule.dev/llms.txt
> Use this file to discover all available pages before exploring further.
> For every page in one file, fetch https://bun.manicule.dev/llms-full.txt (large).
> To search and read these docs as tools, connect the MCP server at https://bun.manicule.dev/api/mcp.
> Every agent surface: https://bun.manicule.dev/.well-known/llms-manifest.json

# Convert a Buffer to a string (/guides/binary/buffer-to-string)

<!-- agent-signals: reading_time_min: 1 · est_tokens: 110 · updated: 2026-08-02 -->
Related: [Convert an ArrayBuffer to a string](/guides/binary/arraybuffer-to-string.md), [Convert an ArrayBuffer to a Buffer](/guides/binary/arraybuffer-to-buffer.md), [Convert an ArrayBuffer to a Blob](/guides/binary/arraybuffer-to-blob.md), [Convert an ArrayBuffer to an array of numbers](/guides/binary/arraybuffer-to-array.md), [Convert an ArrayBuffer to a Uint8Array](/guides/binary/arraybuffer-to-typedarray.md), [Convert a Buffer to an ArrayBuffer](/guides/binary/buffer-to-arraybuffer.md)

The [`Buffer`](https://nodejs.org/api/buffer.html) class provides a `.toString()` method that converts a `Buffer` to a string.

```ts
const buf = Buffer.from("hello");
const str = buf.toString();
// => "hello"
```

***

You can optionally specify an encoding and byte range.

```ts
const buf = Buffer.from("hello world!");
const str = buf.toString("utf8", 0, 5);
// => "hello"
```

***

See [Binary Data](/runtime/binary-data#conversion).
