What you can paste
- A bare Base64 string, such as the value of an
imagefield in an API response. - A complete data URI starting with
data:image/png;base64,. The header is skipped automatically. - URL-safe Base64 and strings with the
=padding missing. - Strings broken across lines, as they appear in emails or PEM-style files. Line breaks and spaces are ignored.
Recognising an image from its first characters
The file type is decided by the first bytes of the data, not by any label. Because of that, each format always starts with the same Base64 characters.
| Format | First bytes (hex) | Base64 starts with |
|---|---|---|
| PNG | 89 50 4E 47 | iVBORw0KGgo |
| JPEG | FF D8 FF | /9j/ |
| GIF | 47 49 46 38 | R0lGOD |
| WebP | 52 49 46 46 … 57 45 42 50 | UklGR |
| SVG | 3C 73 76 67 (<svg) | PHN2Zy |
| 25 50 44 46 (%PDF) | JVBERi0 |
When the picture does not appear
- “Not allowed in Base64” means a stray character was copied, often a quote, a comma or
\nwritten out as two characters. The message gives its position. - A picture that is cut off part way down means the string was truncated. Compare the byte size shown with the size you expected.
- “Binary data” with unfamiliar first bytes means the content is not an image, or it is compressed or encrypted.
Questions
How do I save the image?
Right-click the preview and choose “Save image as”. The file is created by your browser from the decoded bytes.
Is the image uploaded to show the preview?
No. The bytes are decoded in this tab and displayed from memory.