Converter

Base64 to JSON Converter // JSON.parse(atob())

Decode a Base64 string and pretty-print the result as formatted JSON. Perfect for debugging API responses and JWT payloads.

🛡 100% client-side ⚡ Instant
🔒 Privacy First: All decoding happens locally in your browser. Your data never leaves your device.

What Is Base64 to JSON Conversion?

Many APIs, tokens, and configuration systems transmit JSON data encoded as Base64. The encoded string travels safely through HTTP headers, URL parameters, and text-only channels that cannot handle raw JSON's special characters. Decoding the Base64 string reveals the underlying structured JSON object.

Common examples include JWT token payloads, AWS Lambda event bodies, GitHub webhook secrets, and Kubernetes ConfigMap values. This tool decodes the Base64 string and attempts to parse the result as JSON — if successful, it pretty-prints the object with proper indentation. If the decoded content is not valid JSON (for example, it is plain text or binary data), the raw decoded text is displayed instead.

How Do JWT Tokens Use Base64?

A JSON Web Token (JWT) consists of three sections separated by dots: header.payload.signature. Each section is independently Base64URL-encoded (the URL-safe variant that uses - and _ instead of + and /, without padding). Pasting the middle section — the payload — into this tool reveals the claims inside the token.

// Example JWT structure
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9   ← Header
.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ   ← Payload
.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c   ← Signature

// Decoded payload:
{
  "sub": "1234567890",
  "name": "John Doe",
  "iat": 1516239022
}

This tool handles both standard Base64 (with = padding and +// characters) and URL-safe Base64 (without padding, using -/_). Paste just the payload section (between the first and second dot) to inspect the claims. Note: this tool does not verify the signature — use a dedicated JWT library for signature verification.

Common API Patterns That Use Base64-Encoded JSON

Several widely used platforms encode JSON payloads as Base64 before transmitting them. Knowing these patterns helps when debugging integrations and parsing webhook data.

  • AWS Lambda event payloads: API Gateway passes request bodies as Base64 when isBase64Encoded is true in the Lambda event object.
  • GitHub webhooks: Some GitHub App payloads and content API responses return file contents Base64-encoded.
  • OAuth tokens: OAuth 2.0 access tokens and ID tokens from providers like Google and Auth0 are JWTs with Base64URL-encoded payloads containing user and permission claims.
  • Kubernetes ConfigMaps and Secrets: Kubernetes Secret objects store all values as Base64-encoded strings. kubectl get secret my-secret -o json shows the encoded values.
  • HTTP Basic Auth headers: The Authorization: Basic header encodes username:password as Base64. Decoding the value after Basic reveals the credentials.

For quick validation of a Base64 string before decoding, use the Base64 validator.

How Do You Decode Base64 to JSON in Code?

Every major language provides built-in Base64 decoding. Combine it with a JSON parser to extract the structured data.

// JavaScript (browser or Node.js)
const decoded = JSON.parse(atob(base64str));
console.log(decoded);

// Node.js (Buffer API)
const decoded = JSON.parse(Buffer.from(base64str, 'base64').toString('utf8'));

// Python
import base64, json
decoded = json.loads(base64.b64decode(b64str))

// Java
import java.util.Base64;
import com.fasterxml.jackson.databind.ObjectMapper;
byte[] bytes = Base64.getDecoder().decode(b64str);
Map decoded = new ObjectMapper().readValue(bytes, Map.class);

// Go
import ("encoding/base64"; "encoding/json")
bytes, _ := base64.StdEncoding.DecodeString(b64str)
var result map[string]interface{}
json.Unmarshal(bytes, &result)

// PowerShell
$bytes = [Convert]::FromBase64String($b64str)
$json = [Text.Encoding]::UTF8.GetString($bytes) | ConvertFrom-Json

For URL-safe Base64 (JWT payloads), replace - with + and _ with /, then add = padding before decoding. In Python, use base64.urlsafe_b64decode() instead. See the Base64 in Python guide or the Base64 in JavaScript guide for full examples. For PowerShell, see the Base64 in PowerShell guide.

Frequently Asked Questions

What does this Base64 to JSON converter do?

This tool decodes a Base64 string using atob(), then attempts to parse the decoded text as JSON using JSON.parse(). If parsing succeeds, the output is displayed as pretty-printed JSON with 2-space indentation using JSON.stringify(obj, null, 2). If the decoded content is not valid JSON, the raw decoded text is shown along with a note. All processing runs in your browser — no data is sent to a server.

Can I use this tool to decode JWT payloads?

Yes. Paste the middle section of a JWT (the text between the first and second dot) into the input. JWT tokens use URL-safe Base64 without padding — this tool automatically handles the URL-safe alphabet (- and _ instead of + and /) and adds padding as needed. The decoded payload shows the JWT claims such as sub, iat, exp, and custom fields.

What happens if the decoded content is not valid JSON?

If the Base64 string decodes to something that is not valid JSON — such as plain text, HTML, or binary data — the tool displays the raw decoded text with a note explaining that JSON parsing was not possible. You can still copy the raw decoded content. For binary data, the output may contain garbled characters because the browser interprets the bytes as Latin-1 text.

Is Base64 to JSON conversion secure?

All decoding runs locally in your browser using native JavaScript APIs (atob() and JSON.parse()). No data is transmitted to any server. This makes the tool safe for decoding sensitive payloads such as API tokens, JWT claims, and internal configuration data. The tool does not log, store, or transmit your input or output.