Base64
Plain text

How to decode Base64 to plain text

  1. Paste the Base64-encoded string into the input field — a JWT payload, HTTP auth header, data URI content, or any Base64 string.
  2. Click "Convert" — the decoded plain text output appears instantly.
  3. Switch to "Encode" using the toggle above if you need to encode text to Base64.
  4. Click "Copy" to copy the decoded text, or "Download .txt" to save the file.
  5. Inspect the decoded content — API keys, JWT claims, config values, or any text that was encoded for safe transmission.

How Base64 decoding works

Base64 decoding reverses the encoding: the input string of Base64 characters is read 4 characters at a time, each group is mapped back to three bytes using the 6-bit values from the Base64 alphabet, and the resulting byte sequence is interpreted as UTF-8 text. This converter uses the browser's TextDecoder API to correctly handle the full Unicode range — including multibyte characters like emoji, CJK, and accented letters. No data leaves your machine — the conversion runs entirely in your browser.

The decoder accepts both standard Base64 (using + and /) and Base64URL (using - and _). It handles optional = padding and strips leading/trailing whitespace automatically, making it practical for decoding strings copied from JWT tokens, HTTP headers, and logs where extra whitespace is common.

How the converter decodes Base64 to Unicode text
// The converter uses TextDecoder for proper Unicode support:
function base64Decode(encoded) {
  const normalized = encoded.trim()
    .replace(/-/g, '+').replace(/_/g, '/')  // Base64URL → standard
  const binary = atob(normalized)
  const bytes  = Uint8Array.from(binary, c => c.charCodeAt(0))
  return new TextDecoder().decode(bytes)    // UTF-8 bytes → Unicode string
}

base64Decode('SGVsbG8sIFdvcmxkIQ==')   // → 'Hello, World!'
base64Decode('eyJuYW1lIjoiQWxpY2UifQ') // → '{"name":"Alice"}' (JWT payload)
base64Decode('SGVsbG8g8J+MjQ==')        // → 'Hello 🌍'

Common Base64 data you might decode

Base64-encoded strings appear in many places in web development and system administration. Knowing the source helps you understand what to expect from the decoded output.

  • JWT tokens — JSON Web Tokens have three Base64URL sections separated by dots. Decoding the second section (payload) reveals the claims: user ID, expiration time, roles, and other metadata. The third section (signature) is binary and will produce unreadable output.
  • HTTP Basic Auth — the Authorization: Basic ... header contains Base64(username:password). Decoding it reveals the credentials in plaintext, which is why HTTPS is required for Basic Auth.
  • Data URIs — data:image/png;base64,... or data:application/json;base64,... strings can be decoded to reveal embedded file content or JSON payloads.
  • API keys in config files — some platforms store API keys, certificates, or secrets as Base64 in environment variables or YAML config files.
  • Email MIME headers — encoded subject lines and attachment filenames use Base64: =?UTF-8?B?...?=
  • Debug logs — some systems log payloads as Base64 to avoid special character issues in log files.

Base64 variants: standard, URL-safe, and MIME

There are several Base64 variants that differ in their alphabet and line handling. This converter handles the two most common variants automatically:

VariantCharacters 62/63PaddingUsed in
Standard Base64+ and /= requiredMIME email, data URIs, HTTP Basic Auth
Base64URL- and _= optionalJWT tokens, URL parameters, filenames
MIME Base64+ and /= requiredEmail attachments (76-char line breaks)

The decoder automatically normalizes Base64URL input (- → +, _ → /) before decoding, so you can paste JWT payload sections or URL parameters directly without manually converting them to standard Base64 first.

When Base64 decoding fails and why

Common reasons decoding fails:

  • Invalid characters — standard Base64 only uses A–Z, a–z, 0–9, +, /, and =. Characters like spaces, commas, or line breaks outside the alphabet cause a decode error. Strip or clean extra characters first.
  • Incorrect length — Base64 strings must have a length that is a multiple of 4 (with padding). Missing = characters cause a length error. Try adding one or two = at the end.
  • URL-encoded characters — Base64 strings in URLs may have + replaced with %2B and = replaced with %3D. URL-decode the string first before pasting.
  • Partial strings — copying only part of a Base64 string (from a truncated log line) produces invalid input. Make sure the complete encoded string is pasted.
  • Non-UTF-8 binary output — if the decoded bytes are binary file data rather than UTF-8 text, the output will appear garbled. This decoder is designed for text input and output.
Decoding a JWT payload section
// A JWT has three dot-separated sections:
// header.payload.signature

// To inspect claims, copy only the second section:
// eyJzdWIiOiIxMjM0IiwibmFtZSI6IkFsaWNlIiwiaWF0IjoxNjE2MjM5MDIyfQ

// Decoded output:
// {"sub":"1234","name":"Alice","iat":1616239022}

// ⚠️ The third section (signature) is cryptographic binary.
// Decoding it produces unreadable characters — this is expected.
// Only decode the header (first section) and payload (second section).

Security: what Base64 decoding reveals

Base64 encoding provides no security — it is a public, standardized encoding with no key. Anything encoded in Base64 can be decoded by anyone instantly. This has important implications for web security:

  • JWT payloads are public — the header and payload of a JWT are Base64URL-encoded with no encryption. Anyone with the token can decode the payload and read all claims. The signature verifies authenticity but does not hide the content.
  • HTTP Basic Auth is plaintext exposure — the Authorization: Basic header transmits username and password Base64-encoded, which is equivalent to plaintext. Always use HTTPS with Basic Auth; without TLS, credentials are trivially extractable.
  • "Obfuscated" configs are not secure — storing secrets as Base64 in source code or config files does not protect them. Use a proper secrets manager (Vault, AWS Secrets Manager, GitHub Secrets) for sensitive values.
  • Data URIs can contain executable content — data:text/html;base64,... and data:application/javascript;base64,... can embed HTML or JavaScript. Modern browsers restrict these in certain contexts as a security measure.

Frequently Asked Questions

What is Base64 and why is it used?
Base64 is an encoding scheme that converts binary data into a string of 64 printable ASCII characters. It is used when data needs to be safely transmitted through systems that only support ASCII — such as HTTP headers, email bodies, URLs, and configuration files.
Can this tool decode Base64URL (used in JWT tokens)?
Yes. The decoder automatically normalizes Base64URL encoding (- → +, _ → /) before decoding. You can paste a JWT payload section directly — the Base64URL variant is handled transparently without any manual conversion.
How do I decode a JWT token payload?
A JWT has three sections separated by dots: header.payload.signature. Copy only the second section (the payload — the middle part). Paste it into the decoder and click Convert. The output is the JSON object containing the token's claims (user ID, expiration, roles, etc.). Do not try to decode the third section (signature) — it is binary and produces unreadable output.
What does "invalid Base64 input" mean?
The input contains characters not in the Base64 alphabet, has an incorrect length, or has missing padding. Common causes: extra spaces or newlines in the pasted string, URL-encoded + as %2B, or copying only part of a Base64 string. Strip whitespace, URL-decode if needed, and make sure the full string is pasted.
Does the decoder support Unicode output (emoji, CJK, accented letters)?
Yes. The converter uses the browser's TextDecoder API to interpret the decoded bytes as UTF-8. Any text that was encoded as UTF-8 — including all Unicode characters — will be correctly decoded to its original form.
Can I decode a data URI with this tool?
Yes — copy the Base64 portion after the comma: data:...;base64,COPY_THIS_PART. If the data URI encodes text (JSON, SVG, HTML, XML), the decoded output is readable text. If it encodes a binary file (PNG, PDF, font), the decoded bytes will appear as garbled symbols — this tool is designed for text-based data.
Is Base64 the same as encryption?
No. Base64 is encoding, not encryption. It has no key, no secret, and no security guarantee. Anyone who has a Base64-encoded string can decode it instantly. Never rely on Base64 to protect sensitive information.
Why does the decoded output look garbled or contain symbols?
This happens when the Base64-encoded source is binary data (an image, a PDF, a compiled binary) rather than UTF-8 text. The decoded bytes are not valid UTF-8, so the TextDecoder produces replacement characters. This decoder is designed for text inputs; binary file content will not decode to readable text.
Does the decoder handle missing = padding?
Yes. The decoder adds missing = padding automatically before passing the string to atob(). Base64URL encoding often omits = characters, so this normalization is needed for JWT tokens and URL parameters.
What is the difference between decoding and decrypting?
Decoding reverses an encoding transformation — it is deterministic and requires no key. Base64 decoding always produces the same output for the same input. Decrypting reverses encryption — it requires a secret key and produces gibberish without the correct key. Base64 is encoding; AES and RSA are encryption.
Is any data sent to a server during decoding?
No. The entire decoding runs in your browser using the built-in atob() and TextDecoder APIs. No data is transmitted over the network — there are no privacy concerns and no file size limits.
Can I decode multiple Base64 strings at once?
The decoder processes one string at a time. For bulk decoding in code, the equivalent call is: new TextDecoder().decode(Uint8Array.from(atob(str), c => c.charCodeAt(0))). This handles the same Unicode normalization as this converter.