Skip to content

Base64 to JSON Decoder

Decode Base64 to JSON in your browser: paste the string and get formatted JSON, or plain text if it is not JSON.

Input · Base64
Output · JSON
Valid TextRuns in your browser

Load from a URL

Your browser fetches it directly, so the server must allow cross-origin requests (CORS).

How to decode Base64 to JSON

  1. Paste the string: standard Base64, Base64URL or a data: URL. Spaces, line breaks and missing = padding are fine.
  2. Pick the JSON Indent: 2 spaces, 4 spaces or tabs.

Example

JSON often arrives Base64-encoded in message queue payloads, webhook bodies, Kubernetes Secrets and the first two parts of a JWT. This string:

eyJvcmRlcklkIjoiU08tNTUyMSIsInN0YXR1cyI6InNoaXBwZWQiLCJjYXJyaWVyIjoiREhMIiwiaXRlbXMiOjMsImV0YSI6IjIwMjYtMTEtMDcifQ==

decodes to:

{
  "orderId": "SO-5521",
  "status": "shipped",
  "carrier": "DHL",
  "items": 3,
  "eta": "2026-11-07"
}

Base64 or Base64URL

Base64 uses + and / and pads with =. Base64URL (RFC 4648, section 5) uses - and _ and usually drops the padding, so it fits in URLs and tokens. The same object in both forms:

eyJxIjoiw6k/Pj5+fn4iLCJvayI6dHJ1ZX0=
eyJxIjoiw6k_Pj5-fn4iLCJvayI6dHJ1ZX0

Both decode alike; the second adds the note Read as Base64URL. For a whole token with its claims and expiry, use the JWT decoder.

When the result is not JSON

  • Plain text such as user=ana&role=admin is shown as text, with the note Decoded, but the result is not JSON. Shown as plain text.
  • Gzip data starts with H4sI when encoded and decodes to noise. Decompress it first (below).
  • Other encodings. Bytes are read as UTF-8, so UTF-16 text comes out garbled.
  • JSON inside a string. A single quoted string full of \" was stringified before encoding: unescape it with JSON escape, then format it in the JSON formatter.

To decode gzip data on Linux or macOS:

echo 'H4sIAAAAAAAACqtWSlSyMqwFAK+sG1YHAAAA' | base64 --decode | gunzip

It prints {"a":1}.

Questions

Can it encode JSON to Base64?

No, it only decodes. In a browser console, btoa(JSON.stringify(data)) encodes ASCII-only JSON; other characters must be converted to UTF-8 bytes first, or btoa throws.

How do I decode Base64 on the command line?

On Linux and macOS, base64 --decode file.txt. In PowerShell, [Text.Encoding]::UTF8.GetString([Convert]::FromBase64String($s)), where $s holds the string.

Is the decoded data sent anywhere?

No. Decoding uses the browser built-ins atob and TextDecoder, and nothing is saved.

Related tools

Esc