How to Decode Base64 Back to Text (With Examples)
Base64 Decoding
When to Decode Base64
Decode Base64 when inspecting JWT payloads, debugging API responses, reading encoded email parts, or converting data URIs back to readable content.
Real-World Examples
SGVsbG8= → Hello
dXNlcjpwYXNz → user:pass
JWT middle segment (payload) is Base64URL-encoded JSON — decode to inspect claims
Common Mistakes
- Leading or trailing whitespace and surrounding JSON quotes are stripped automatically — other stray characters may still cause decode failures
- Confusing Base64 with Base64URL — this decoder accepts both; full JWT tokens are easier to inspect with the JWT Decoder tool
- Expecting decoded output to always be readable text — it may be binary gibberish if the source was not text
Edge Cases
- Invalid characters (outside the Base64 alphabet) cause decode failures
- Missing padding can break strict decoders — some libraries add padding automatically
- Decoded bytes may require UTF-8 interpretation for non-English text
Developer Tips
- Browser:
atob()returns a binary string; combine withTextDecoderfor Unicode - Always validate decoded content before using it in security-sensitive paths
Frequently asked questions
Why does decoding fail with an invalid character error?
The input likely contains characters outside the Base64 alphabet, PEM headers, or other stray text. Standard and URL-safe Base64 are both accepted — quotes and padding are normalized automatically.
Is decoded Base64 always readable text?
No. If the original data was binary, decoded output may not be human-readable text.
Can I decode JWT tokens here?
You can decode individual Base64URL segments (header or payload). For a full JWT with signature verification context, use the JWT Decoder tool.