Upload a file
  1. base64hub
  2. Text tools
  3. Base64 to JSON

Base64 to JSON: Decode and Pretty-Print JSON

Paste Base64 and get readable, indented JSON. Standard and URL-safe input both work, so API fields, cursors and token segments decode without cleanup.

Free no sign-up, no limits Local nothing uploaded 2-space pretty-print, saves .json Updated Oct 27, 2026
Input 0 BOutput 0 BSize –

Processed in your browser. This page cannot send your data anywhere – how we know

How to decode Base64 to JSON

  1. Paste the Base64 into Input · Base64. The page loads with a sample you can replace.
  2. The JSON appears in Output · text, indented with two spaces. Pretty-print JSON is on by default; untick it to see the exact decoded text.
  3. Check the status line: Looks like JSON means the result parsed as valid JSON.
  4. Copy output copies the formatted JSON. Download saves the original decoded bytes as decoded.json.

The sample eyJpZCI6NDIsIm5hbWUiOiJiYXNlNjRodWIiLCJ0YWdzIjpbImpzb24iLCJkZWNvZGUiXSwiYWN0aXZlIjp0cnVlfQ== decodes and formats to:

{
  "id": 42,
  "name": "base64hub",
  "tags": [
    "json",
    "decode"
  ],
  "active": true
}

To go the other way, use JSON to Base64.

Spotting JSON inside Base64

JSON almost always starts with { or [, and those bytes produce a few recognizable openings:

Base64 starts withDecoded startTypical source
eyJ{" + a letterCompact objects, JWT header and payload
eyI{" + a digit or symbolObjects whose first key starts with a digit
eyAi{ "Objects with spaces
ewog{ + newline + spacesPretty-printed files
W3s[{Arrays of objects
WyJ[" + a letterArrays of strings

So eyJhIjoxfQ== is {"a":1} and W3siYSI6MX1d is [{"a":1}]. The common Base64 prefixes page has more of these patterns for other formats.

Where Base64-encoded JSON comes from

  • The header and payload of a JSON Web Token (JWT) are Base64URL-encoded JSON, separated by dots. Paste one segment here, or the whole token into the JWT decoder. Base64 in JWT explains the format.
  • Some APIs and webhooks pass structured metadata, pagination cursors or event payloads as Base64 strings inside another JSON document. If you have the outer document, decode Base64 inside JSON finds and decodes every such field at once.
  • A Kubernetes .dockerconfigjson Secret stores container registry credentials as Base64 of a JSON document that itself contains Base64 auth values; the Docker config JSON decoder unpacks both layers.
  • Environment variables and CI secrets often carry a JSON config as one Base64 line to avoid quoting problems.

URL-safe input (- and _, no padding) is accepted automatically, so token segments decode as they are.

When the JSON does not format

Pretty-printing needs valid JSON. When parsing fails, the decoded text is shown unchanged, which is usually enough to see the problem:

  • The data is truncated and the text ends mid-value. Check that you copied the whole Base64 string; Repair Base64 helps when line breaks or quotes got mixed in.
  • The text is not quite JSON. Single quotes, trailing commas ({"a":1,} is eyJhIjoxLH0=) and comments are common in hand-written config but invalid in JSON.
  • The charset is wrong. JSON is UTF-8 by definition (RFC 8259), so if accented characters look wrong, the producer used another encoding; try Charset.
  • The payload is compressed. If the output is unreadable and the Base64 starts with H4sI, the JSON was gzipped before encoding. Use the gzip Base64 decoder.

Base64 to JSON in code

import base64, json

s = "eyJpZCI6NDIsIm5hbWUiOiJiYXNlNjRodWIiLCJ0YWdzIjpbImpzb24iLCJkZWNvZGUiXSwiYWN0aXZlIjp0cnVlfQ=="
data = json.loads(base64.b64decode(s))
print(json.dumps(data, indent=2))

json.loads accepts the bytes directly. In JavaScript, decode to bytes and then through TextDecoder, because JSON.parse(atob(s)) garbles any non-ASCII characters:

const s = "eyJuYW1lIjoiYmFzZTY0aHViIn0=";
const json = new TextDecoder().decode(Uint8Array.from(atob(s), c => c.charCodeAt(0)));
JSON.parse(json).name;   // "base64hub"

See Base64 in Python and Base64 in JavaScript for URL-safe variants.

FAQ

How do I decode Base64 to JSON?

Paste the Base64 above. The decoded JSON is pretty-printed, and Download saves it as decoded.json. In code: json.loads(base64.b64decode(s)) in Python, JSON.parse(Buffer.from(s, "base64").toString()) in Node.js.

Why isn't my JSON pretty-printed?

The decoded text is not valid JSON, so it is shown as is. Typical causes are a truncated string, single quotes, a trailing comma or comments. The “Looks like” field then says Text instead of JSON.

How do I know a Base64 string is JSON?

Most JSON objects encode to a string starting with eyJ, which is {" followed by a letter. Arrays of objects start with W3s, and pretty-printed JSON often starts with ewog.

Can I decode a JWT payload here?

Yes, paste the middle segment (between the two dots). For the whole token with expiry dates and signature checks, use the JWT decoder.