JSON to Base64
Encode JSON as a Base64 string — minified first, UTF-8 safe. For data URIs, JWT-style payloads, config in env vars and query params.
Why Base64-encode JSON?
Base64 turns arbitrary text into a compact ASCII string that survives places raw JSON can't go cleanly: data URIs (data:application/json;base64,…), JWT-style payloads, config stuffed into a single environment variable or query parameter, and message fields that must be plain ASCII. This tool minifies your JSON first, so the encoded string is as short as possible, and encodes via UTF-8 — emoji and accented characters round-trip correctly.
UTF-8 done right
The naive btoa(json) throws or corrupts on any non-Latin-1 character — a very common bug. This tool encodes the JSON to UTF-8 bytes first, so {"city":"München","flag":"🇦🇹"} encodes and decodes losslessly. The reverse direction lives at Base64 to JSON.
Not encryption
Worth stating plainly: Base64 is encoding, not encryption. Anyone can decode it — it hides nothing. Use it to make data transport-safe, never to protect secrets. And as with every tool here, the encoding happens entirely in your browser; nothing is uploaded.
Frequently asked questions
Does it handle Unicode / emoji correctly?
Yes. The JSON is encoded to UTF-8 bytes before Base64, so characters like ü, 你好 and 🚀 survive a full encode/decode round-trip. The common btoa() one-liner does not — it breaks on any non-Latin-1 character.
Is the JSON minified before encoding?
Yes — whitespace is stripped first so the Base64 output is as compact as possible, which matters for URLs and env vars. If you need the exact bytes of a pretty-printed document, encode it elsewhere.
Can I use the output in a data URI?
Directly: data:application/json;base64,<output>. Browsers and most HTTP clients accept that as an inline JSON resource.
Is Base64 secure?
No — it is reversible encoding, not encryption. Anyone can decode it instantly. Never use Base64 to hide passwords, tokens or personal data.