JSON ⇄ Base64

Encode JSON to Base64 and decode Base64 back to pretty JSON.

Conversion


Sponsored

How it works

How it works

  • Uses btoa/atob to Base64‑encode/decode, wrapped with URI encoding tricks to handle UTF‑8 safely in browsers.
  • “JSON → Base64” encodes the raw JSON string; “Base64 → JSON” decodes and pretty‑prints with 2‑space indentation.
  • Note: btoa/atob operate on Latin‑1; the wrapper avoids mojibake for non‑ASCII text. For binary data, prefer Uint8Array and a dedicated Base64 routine.
  • Base64URL uses -/_ instead of +// and strips = padding (not used here).

Privacy & Security

No network traffic.

Accuracy, Limits & Tips

Large objects may be slow; no streaming.

Examples

  • {"foo":123}eyJmb28iOjEyM30=

Looking for broader guides and best practices? Visit the ToolsAreUs Blog for indexes (like the full tool list) and articles (e.g. secure password generation).