Decode Base64 to Formatted JSON – Free

Decode Base64 to JSON and read it formatted. The tool decodes the string in your browser, validates the JSON and prints it with two-space indentation without altering any value.

How to use the Base64 to JSON tool

  1. Paste the encoded JSON into the Base64 or Base64 data URL box. For a JWT, paste one dot-separated segment at a time.
  2. Select Decode, or select Example to see a small object decoded.
  3. Read the indented JSON in the Result box.
  4. Select Copy to take the formatted JSON to your editor or API client.

What the Base64 to JSON decoder does

The conversion has three stages. The Base64 is decoded to bytes. The bytes are read as UTF-8, strictly, so invalid sequences raise an error. The text is then parsed as JSON to prove it is valid, and finally laid out with two spaces per nesting level, one member per line and a space after each colon.

The formatter rearranges whitespace only. It works on the original tokens, so nothing is normalized: keys keep their order, duplicate keys are kept, string escapes stay as written, and numbers keep every digit. Empty objects and arrays print as {} and [].

Worked example

The Example value decodes to a one-member object. The second input shows why token-level formatting matters. Its id has 20 digits, more than a JavaScript number can hold exactly. Formatters that parse and re-serialize would print 12345678901234567000 and shorten 1.50 to 1.5. This tool prints both as they were sent.

eyJoZWxsbyI6IndvcmxkIn0=

{
  "hello": "world"
}

eyJpZCI6MTIzNDU2Nzg5MDEyMzQ1Njc4OTAsInByaWNlIjoxLjUwfQ==

{
  "id": 12345678901234567890,
  "price": 1.50
}

Recognizing JSON inside Base64

An object whose first key starts with a letter begins with the bytes 7B 22, and Base64 turns that into eyJ. That is why JWT headers and payloads start with eyJ. An array of objects starts with W3si. A leading 77u/ is a UTF-8 byte order mark in front of the JSON.

Why decoding to JSON fails

Each stage has its own failure, and the message tells you which stage stopped. The wording of UTF-8 and JSON errors comes from your browser, so it differs between Chrome, Firefox and Safari.

  • Enter valid Base64 or Base64URL data: the input is not decodable. A whole JWT fails here because the dots between segments are not Base64 characters.
  • A UTF-8 error from the browser: the bytes are binary or use another character encoding.
  • A JSON syntax error from the browser's parser: the text is not strict JSON. Single quotes, trailing commas, comments, NaN and several objects in a row are all rejected.
  • A syntax error at the first character when the data starts with a byte order mark. The mark is kept, and JSON does not allow it.

Where Base64 encoded JSON appears

JWTs are the common case: header and payload are JSON encoded with unpadded Base64URL, which this tool accepts directly. Kubernetes stores registry credentials as Base64 JSON in the .dockerconfigjson key of a Secret. Message queues and webhook systems wrap event bodies in a Base64 data field.

Decoding shows the content but verifies nothing. A JWT payload is readable without the signing key, and reading it does not prove the token is authentic.

Frequently asked questions

Is the JSON decoded in my browser?

Yes. Decoding, validation and formatting are done by script on this page. Token payloads and configuration data you paste are not sent to a server.

Can I paste a complete JWT?

No. A JWT is three Base64URL segments joined by dots, and the dots make the input invalid. Paste the header or the payload segment alone.

Does the decoder change my JSON values?

No. It validates the text, then reprints the original tokens with new whitespace. Key order, duplicate keys, large integers, decimal places and escape sequences such as \u00e9 remain exactly as encoded.

Why does valid-looking JSON fail to parse?

The parser follows the JSON standard, RFC 8259, with no extensions. Check for single-quoted strings, unquoted keys, a trailing comma, comments, or invisible characters such as a byte order mark at the start of the data.

Does it accept JSON that is not an object?

Yes. Any valid JSON value is accepted, including arrays, strings, numbers, true, false and null.

How do I encode JSON back to Base64?

Use the JSON to Base64 tool on this site. It checks that the text parses as JSON and then returns standard padded Base64 of the UTF-8 bytes.

Related tools