Skip to content
toolsdocks

Decode Base64 to an image

Paste a Base64 string or a data: URI and see the image it holds. This page opens the encoder and decoder set to Base64 and Decode; the file type is read from the bytes themselves and the width and height from the image header.

Runs on your device

More options in the full Encoding toolkit.

Loading tool…

How to use it

  1. Paste the Base64 string or data: URI into the input box, or select Try a Base64 image.
  2. Leave Encoding on Base64 and Direction on Decode (preselected here).
  3. Check the preview, the detected type and the pixel size.
  4. Select Download to save the image with the right extension.

Worked example

The sample data:image/png;base64,iVBORw0KGgo... (164 characters of Base64) decodes to a 123-byte PNG of 24 x 24 px, a small gift box, saved as image.png.

Formats and limits

InputBase64, data: URI
OutputPNG, JPEG, GIF, WebP, SVG
EngineTextEncoder/TextDecoder with strict validation

Limitations

  • HEIC and TIFF images are detected and can be downloaded, but only Safari shows a preview.
  • The size comes from the header for PNG, JPEG, GIF, WebP, BMP, ICO, AVIF and SVG with width and height or a viewBox; otherwise the size the browser drew is shown.
  • For an ICO file with several sizes, the first one is reported.

Questions

Do I need the data:image/png;base64, prefix?

No. A bare Base64 string works, and so does a full data: URI, one wrapped in quotes or CSS url(), or Base64 split over several lines. URL-safe Base64 with - and _ is accepted too.

Why does it say the type differs from the data URI?

The type is checked from the first bytes of the file. When a data: URI says image/jpeg but the bytes are a PNG, the download is saved as .png, its real type.

Why do I get an error instead of an image?

The text is not valid Base64 (the error gives the position of the first bad character), it was cut off when copied, or it decodes to something other than an image, such as text or a PDF.

Is my data uploaded?

No. The Base64 is decoded in your browser and the preview is drawn from a local copy; nothing is uploaded.

Privacy

Runs on your device. Files and text are processed in this browser tab and are not uploaded.

This page opens the Encoding toolkit ready for this task. See the privacy policy for how toolsdocks handles data.