1. Home
  2. Images
  3. Base64 to Image

Base64 to Image

Paste Base64 or a data URI to detect the format, preview it and save the image.

Runs in your browser · No upload Works offline
You can paste a whole CSS url(…) or <img src="…"> — only the data URI part is read.

A 16×16 PNG is loaded as an example. Clear it and paste your own Base64.

To turn an image into Base64, use Image to Base64.

Detected format
PNG (image/png)
Format in data URI
image/png
File size
120 B (120 B)
Dimensions
—

How to use

  1. Paste a Base64 string or a data URI such as data:image/png;base64,… into the box.
  2. A whole CSS url("…"), HTML <img src="…"> or JSON string works too — only the data URI part is read. Line breaks, spaces and escapes like \n are removed automatically.
  3. Check the preview and the detected format, then click Save. The file extension matches the real data format.

Decoding happens in your browser; nothing you paste is sent to a server.

How the format is detected

The image/png label in a data URI can be wrong, so this tool looks at the first bytes of the decoded data (the file signature) to identify the real format. You can often tell the format from the start of the Base64 string alone.

Format File signature Base64 starts with
PNG 89 50 4E 47 0D 0A 1A 0A iVBORw0KGgo
JPEG FF D8 FF /9j/
GIF GIF87a / GIF89a R0lGOD
WebP RIFF … WEBP UklGR
SVG <svg or <?xml PHN2Zy / PD94bWw
ICO 00 00 01 00 AAABAA
PDF (not an image) %PDF JVBERi

AVIF, HEIC, TIFF, BMP and JPEG XL are detected as well. Formats the browser cannot display, such as HEIC or TIFF, can be saved but not previewed.

Example

The sample loaded on first visit is a 16×16 pixel PNG: 120 bytes as a file, 160 characters in Base64. Since Base64 turns 3 bytes into 4 characters, characters × 3 ÷ 4 gives a quick estimate of the file size.

When something goes wrong

  • Invalid characters: Base64 only uses A–Z, a–z, 0–9, +, / and trailing =. The tool tells you which character is the problem so you can remove anything that slipped in while copying.
  • Invalid length: usually the end of the string was cut off — copy it again from the source. A missing trailing = is fixed automatically.
  • URL-safe Base64: the variant using - and _ (common in JWTs) is converted to standard Base64 for you.

FAQ

What if the data URI type and the detected format disagree?

The label in the data URI is wrong (for example, PNG data labelled image/jpeg). The file is saved with the extension of the real format.

Is it safe to save an SVG?

The preview is rendered as an image, so scripts never run. If the SVG contains scripts, you will see a warning — do not open untrusted SVG files directly in a browser.

How do I go the other way?

Use Image to Base64. For Base64 of plain text, use the Base64 encoder/decoder.

Coming soon

Can't find the tool you need?

Tell us what you want to do. We build the most requested tools first.