DataShift

Base64 Decode & Encode

Decode base64 strings to text or JSON, or encode text to base64. Handles URL-safe base64 (- and _ characters), missing padding, and auto-formats JSON output.

Where developers use base64

JWT tokens

The header and payload sections of a JWT are base64url-encoded JSON. Decode the middle section to inspect claims: user ID, roles, expiry time, and any custom fields.

Basic Auth headers

HTTP Basic Authentication encodes credentials as base64(username:password). Decode an Authorization header to verify what credentials are being sent — useful when debugging auth failures.

Data URLs

Images embedded in CSS or HTML as data:image/png;base64,... contain base64-encoded binary data. Encoding text content the same way lets you embed small files inline.

API responses with encoded payloads

Some APIs (AWS SNS, GitHub webhooks) base64-encode the message body. Decode the payload field to see the actual event data.

Example

Decoding a JWT payload to inspect the claims

Input (base64url)
eyJ1c2VyIjoiYWxpY2UiLCJyb2xlIjoiYWRtaW4iLCJpYXQiOjE3MDUzMTIwMDB9
Output (decoded JSON)
{
  "user": "alice",
  "role": "admin",
  "iat": 1705312000
}

The decoded payload is valid JSON — auto-formatted for readability. The iat value is a Unix timestamp (seconds since epoch).

Frequently asked questions

What is base64 and why is it used?

Base64 encodes arbitrary bytes as printable ASCII characters using a 64-character alphabet (A-Z, a-z, 0-9, +, /). It's used whenever binary data needs to travel through a system that only handles text — email attachments, JSON API payloads, HTTP headers, and HTML data URLs all use base64 for this reason.

What is URL-safe base64?

Standard base64 uses + and / which have special meaning in URLs. URL-safe base64 (also called base64url) replaces + with - and / with _, and typically removes the = padding characters. JWTs always use URL-safe base64. Enable the URL-safe toggle when working with JWT payloads, URL parameters, or filenames.

How do I decode a JWT payload?

A JWT looks like xxxxx.yyyyy.zzzzz. The middle section (yyyyy) is the payload — base64url-encoded JSON. Copy just that section, paste it here with URL-safe mode enabled, and click Decode. You'll see the claims as formatted JSON.

I'm getting an 'Invalid character' error. What's wrong?

The input contains a character outside the base64 alphabet. Common causes: the string was URL-encoded (%3D instead of =), it contains whitespace or newlines, or it was truncated. Try enabling URL-safe mode if the string came from a JWT or URL parameter.

Can I encode a JSON object to base64?

Yes. Switch to Encode mode, paste your JSON (or any text), and click Encode. The output is the base64 string. Use URL-safe mode if the result will go in a URL or JWT.