JSON to Base64

Validate JSON, optionally minify, and encode it as Base64 (standard or URL-safe).

JSON to Base64 encodes a JSON document as Base64 text, and decodes Base64 back into JSON. It validates the JSON first, lets you minify or pretty-print it, and can produce the URL-safe alphabet. It is useful for putting a JSON payload into a URL, header, environment variable or token-like string.

What does it mean to Base64 encode JSON?

JSON is text, and Base64 is a way to write bytes using only 64 safe printable characters. To encode JSON, the text is first converted to UTF-8 bytes and those bytes are then written in Base64. The result contains no quotes, braces or spaces, so it survives places that mangle them, such as query strings, HTTP headers or shell variables. The standard alphabet uses plus, slash and equals padding. The URL-safe alphabet from RFC 4648 uses hyphen and underscore and omits padding, which is what JWT segments use. Base64 is an encoding, not encryption: anyone can reverse it, so it should not be used to hide secrets. Because the bytes come from the parsed and re-serialised JSON, whitespace follows the chosen format, not necessarily your original text.

How to use JSON to Base64

  1. Choose an operation Click JSON to Base64 to encode, or Base64 to JSON to decode.
  2. Paste your input Paste the JSON, or the Base64 string, into the JSON / Base64 box. The Output updates as you type.
  3. Set format and alphabet Choose Minify or Pretty under JSON format and Standard or URL-safe under Alphabet.
  4. Copy the result Copy or download the Output.

Frequently asked questions

Is Base64 encryption?

No. It is a reversible encoding with no key, so anyone can decode it. Do not use it to protect secrets.

What is URL-safe Base64?

A variant from RFC 4648 that replaces + and / with - and _ and normally drops the = padding so the string can sit in a URL without escaping.

Why does my output not match another tool?

Encoders can differ in whitespace, pretty-printing and padding. Here the JSON is parsed and re-serialised, so spacing follows the Minify or Pretty choice.

Are non-ASCII characters supported?

Yes. The JSON text is converted to UTF-8 before encoding, and decoding reads UTF-8 back.

Is my JSON sent anywhere?

No. Encoding and decoding happen in the page and the input is not sent to a server.