About Base64 to Image
Base64 image data turns up in API responses, HTML emails, log files, stylesheets and database fields. Staring at the text tells you nothing. Paste it here and you'll see the picture, its true format, its dimensions and its size, and you can save it as a normal file.
It's built to deal with what you really copy, which is rarely tidy. Line-wrapped text, URL-safe characters, a data: prefix or none, a whole CSS url() or an HTML src attribute all work, without anyone having to clean the text first.
Nothing needs to be selected or pressed. The image appears as soon as the text decodes, and there's no format menu since the tool works that out itself.
How it works
The text is stripped of whitespace and any wrapper, URL-safe characters are normalized, and the Base64 is decoded in your browser. The first bytes of the result identify the format, as PNG, JPG, GIF, WebP, BMP, SVG, ICO or AVIF. A wrong label in the data URI is overruled by the bytes, and the page tells you about it.
The file you download is exactly the decoded bytes, with no re-encoding, so a JPG keeps its quality and metadata. When something is wrong, the message is specific: the invalid character and its position, text that seems to be cut off, or data that decodes fine but holds a PDF, say, rather than an image. SVG data is shown through an image element, which means any scripts inside it can't run.
How to use Base64 to Image
- Paste into the Base64 text or data URI box, or press Try an example to see it work.
- Long text in a file? Press Open a text file instead.
- Look at the preview, and at the Type, Dimensions and File size.
- Press the download button. The file is named decoded-image with the right extension.
A real run
data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA4MCA4MCI+PHJlY3Qgd2lkdGg9IjgwIiBoZWlnaHQ9IjgwIiByeD0iMTIiIGZpbGw9IiMxNDUzMmQiLz48Y2lyY2xlIGN4PSI0MCIgY3k9IjQwIiByPSIyMCIgZmlsbD0iI2ZkZTA0NyIvPjwvc3ZnPg==This is the text behind Try an example. The page reported Type SVG, File size 166 B and Dimensions 150 × 150, and saved decoded-image.svg. That size is the browser's default for an SVG with a viewBox but no width or height of its own.
When it helps
- Checking what image an API returned while debugging a JSON response.
- Pulling a logo out of an HTML email's source.
- Recovering an icon embedded in a CSS file so you can edit it.
- Seeing what's inside a suspicious data URI, safely, without running it as a page.
- Verifying that an upload was stored correctly in a database text field.
Tips for a better result
- Copy the whole value. Truncation is the most common failure, and logs and database viewers often cut long fields silently.
- A wrong-type notice often points to a real bug in whatever produced the data, such as a server hard-coding
image/png. - For a file you need to re-use on the web, run it through the Image Compressor, as Base64 data is often unoptimized.
Good to know
- Base64 for a format your browser can't display, such as HEIC or TIFF, will be identified or rejected, but can't be previewed here.
- Only one image at a time. If you paste text with two data URIs, the page handles the first and the rest may be read as bad data.
- Very long text (tens of megabytes) can make the page slow, because it's being held in a text box.
Questions people ask
Do I need to remove the data:image/png;base64, part?
No. Paste with or without it. Whole CSS and HTML snippets containing the value are fine too, and the tool picks out what it needs.
Why does it say the data was cut off?
Valid Base64 never ends with a single leftover character, so the length itself reveals that something is missing. It is usually caused by a log or a database viewer limiting the field. Copy the value from the original source.
Is it safe to decode a Base64 image from someone else?
Decoding happens on your device, and images displayed this way can't run code, including SVGs, because scripts are blocked inside image elements. Be as careful with the saved file as you would be with any download.
Can I choose the output format?
The tool saves exactly what was encoded, so a JPG comes out as a JPG. To change format, save it and then use one of the converters, such as WebP to PNG.
What to use next
- Image to Base64: to go the other way
- Image Compressor: if the decoded image is larger than it should be
- SVG to PNG: if the data held an SVG and you need a bitmap
Last reviewed . Read our editorial policy.