Skip to content
NMSnabbit.

JSON to Base64 Converter

Encode a JSON document into a single Base64 string (UTF-8).

Encoders & Decoders Runs in your browser

How do you convert JSON to Base64?

Query strings mangle raw JSON: the quotes, braces and colons in {“env”:“prod”} all need escaping. Base64-encoding the whole document sidesteps that, producing one opaque token built from letters, digits, + and /. This converter reads your JSON verbatim as UTF-8 text, indentation and all, and never reformats or validates it first, so what you decode later is character-for-character what you pasted.

How to use the JSON to Base64

  1. 1 Paste the JSON document; pretty-printed or minified both encode fine.
  2. 2 A single-line Base64 token builds in the output as you go.
  3. 3 Store or transmit the token, and decode it later with the Base64 to Text page.

What you can use it for

  • Embedding a JSON config inside a URL parameter.
  • Storing a JSON payload in a single text column.
  • Passing JSON through a system that only accepts ASCII.
  • Building a Base64-encoded JSON test fixture.

Frequently asked questions

Does the JSON have to be valid to encode it?
No. Encoding treats the input as plain text, so a half-written draft with a trailing comma encodes fine. Run it through a validator separately if correctness matters downstream.
Will whitespace and indentation be preserved?
Byte for byte. A pretty-printed document with two-space indentation decodes back with the same indentation; just note it produces a longer Base64 string than the minified equivalent would.
How do I decode it later?
Any standard Base64 decoder works: the Base64 to Text page here, atob in JavaScript, or base64 -d in a shell.

Related tools

More Encoders & Decoders

More tools like this:

All Encoders & Decoders