base64 to imagedecode base64data uriimage decodebase64

How to Convert Base64 Back to an Image File

Base64-encoded images appear in API responses, HTML source, and debug logs. Learn how to decode them back into viewable image files instantly.

6 min read

Related Tool

Base64 to Image

Open tool

Base64-encoded images are common in API responses, database fields, email attachments, and HTML source code. When you encounter a long string starting with data:image/ or just a block of Base64 characters in a context where an image is expected, you need to decode it to see what it contains.

When You Encounter Base64 Images

API debugging: some APIs return image data as Base64 in JSON responses. To inspect what the API is actually returning, you decode the Base64 and view the image.

Database inspection: databases sometimes store images as Base64-encoded BLOB values. When inspecting database content, decoding reveals the actual image.

HTML email source: Base64-embedded images in HTML emails appear as large blocks of characters in the HTML source. Decoding them lets you inspect the individual images.

Log analysis: logging systems that capture full request and response bodies sometimes log Base64-encoded images. Decoding the value from the log is the only way to see what image was involved.

How Decoding Works

Base64 encoding uses 64 printable ASCII characters to represent binary data. Every 4 Base64 characters decode back to 3 bytes of binary data. The decoder reverses this mapping. The data URI prefix (data:image/jpeg;base64,) tells the browser the MIME type and that the data is Base64-encoded; the actual decoding of the image bytes follows the prefix.

Using the DevHexLab Base64 to Image Tool

Open the tool at /tools/image/base64-to-image. Paste the Base64 string (with or without the data URI prefix). The image appears in the preview panel immediately. Click Download to save it as a file.

Frequently Asked Questions

What if I only have the raw Base64 without the data URI prefix?

The tool accepts raw Base64 without the prefix. It attempts to detect the image format from the decoded bytes. If detection fails, it defaults to PNG.

Is there a size limit?

The tool runs in the browser, so the practical limit is the available browser memory. Images up to several megabytes Base64-encoded work without issue.

Paste, preview, download.