In this article
Spotting Base64
Base64 strings contain only letters, digits, “+”, “/” (or “-” and “_” in the URL-safe variant) and often end with one or two “=” signs. Their length is usually a multiple of four. Some beginnings give away the content type:
| Starts with | Usually means |
|---|---|
iVBORw0KGgo | PNG image |
/9j/ | JPG image |
R0lGOD | GIF image |
JVBERi0 | PDF document |
UEsDB | ZIP (also .docx, .xlsx) |
eyJ | JSON text, e.g. part of a JWT |
How to decode
- Paste the string into the Base64 Decoder. A
data:prefix and line breaks are removed automatically. - If the result is text, it appears straight away.
- If it is a PNG, JPG, GIF, WebP, PDF or ZIP, the tool recognises it, shows a preview for images, and offers a download with the right file extension.
Both standard and URL-safe Base64 are accepted, with or without padding.
Common errors and fixes
- Invalid character: the string may include quotes, a trailing comma or a backslash from JSON. Copy only the value between the quotes.
- Truncated input: logs often cut long strings. If the image is half grey or the PDF will not open, the data is incomplete.
- Garbled text: the data may not be text at all – check whether it is a file.
- Escaped slashes: JSON sometimes writes “/” as “\/”. Replace “\/” with “/” first.
Decoding images embedded in HTML or CSS
Web pages sometimes embed icons and logos as data:image/png;base64,… strings. Copy everything after the comma (or the whole data URI – the prefix is stripped automatically), decode it, and download the image as a normal file. This is a quick way to recover a small icon whose original file you no longer have.
Decoding JWTs
A JSON Web Token has three Base64 parts separated by dots. You can decode the first two here, but the JWT Decoder does it in one step, shows expiry dates and can verify HMAC signatures.
Is it safe to decode unknown data?
Decoding itself is harmless – it only turns text back into bytes. Be careful with what you do next: do not open downloaded files from untrusted sources, especially executables or documents with macros. The decoder recognises common file types so you know what you are dealing with before you open anything.
Reading email source
If you view the raw source of an email, attachments and some message bodies appear as Base64 blocks under headers like Content-Transfer-Encoding: base64. Copy the block (without the headers) and decode it to recover the attachment or text – handy when an email client shows a message incorrectly.
Privacy
Base64 strings in logs can hold personal data, documents or credentials. ConvertNest decodes them in your browser; nothing is uploaded. To encode data, use the Base64 Encoder.