> ## Documentation Index
> Fetch the complete documentation index at: https://bun-1dd33a4e-farm-3d3ecdde-image-clone-stats.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Encode and decode base64 strings

Bun implements the Web-standard [`atob`](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/atob) and [`btoa`](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/btoa) functions for encoding and decoding base64 strings.

```ts theme={null}
const data = "hello world";
const encoded = btoa(data); // => "aGVsbG8gd29ybGQ="
const decoded = atob(encoded); // => "hello world"
```

***

See [Docs > Web APIs](/runtime/web-apis) for a complete breakdown of the Web APIs implemented in Bun.
