ToolBoxOnline
Developer

Base64 to Image for Email Forensics How to Recover Embedded Images from Email Source Code and HTML Archives

You have an old email archive. The images are embedded as Base64 data URIs in the HTML source. You need to extract them as viewable image files. Here's the email forensics recovery workflow.

Base64 to imageemail forensicsrecoveryarchivedata URI

You are migrating your company's email archives from an old system to a new one. The old system stored emails as raw HTML files. Inline images — logos, signatures, product photos — were embedded as Base64 data URIs in the HTML source. The new system expects image attachments. You have 50,000 emails. Each email has 2-10 embedded images. You need to extract roughly 250,000 Base64-encoded images from HTML source and convert them to image files. Manual extraction is impossible. You need a Base64 to image decoder.

Here is the email forensics and archive recovery workflow — how to extract embedded images from HTML source and convert them to viewable, usable image files.

How to Find Base64 Images in Email Source

Open the email's raw HTML source (View Source in most email clients, or the .eml/.html file in a text editor). Search for: data:image/ — the standard prefix for Base64-encoded images in HTML. A data URI looks like: <img src="data:image/png;base64,iVBORw0KGgoAAAANS...">. The data:image/png;base64, prefix identifies: it is a data URI (inline content, not an external URL), the MIME type is image/png, the encoding is Base64, and the actual image data follows the comma. Copy everything after the comma — the Base64 string. That is the encoded image.

The Bulk Recovery Workflow

Step 1: Extract all data URIs from the HTML archive. Search all email files for data:image/. Extract each Base64 string — everything between the comma and the closing quote of the src attribute. Each extracted string is one embedded image.

Step 2: Decode each Base64 string to an image. Paste each extracted string into the Base64 to image decoder. The tool decodes the Base64 and renders the image. Download the decoded image as a PNG or JPEG file. The image is now a standalone file — no longer embedded in HTML.

Step 3: Verify the decoded images. Spot-check the recovered images. Do they look correct? Are they complete (not truncated)? Is the image format correct (PNG vs JPEG)? The decoder detects the image format automatically from the Base64 header bytes. The output format should match the original format specified in the data URI prefix.

Step 4: Import into the new email system. Attach the recovered images to the corresponding emails in the new system. The emails are now migrated with their images intact. The Base64 data URIs that were embedded in the HTML are now standalone image attachments. The migration is complete.

When Base64 Recovery Is Not Possible

Base64 recovery fails when: the data URI is truncated (the Base64 string is incomplete — the image is partially or fully corrupted), the MIME type is missing or incorrect (the decoder guesses the format, but may guess wrong), and the Base64 string contains line breaks or other corruption (the decoder strips whitespace, but other corruption may prevent decoding). For corrupted Base64 strings, the original image is lost. The decoder can only recover what is present in the source. If the source is corrupted, the recovery is partial at best.

Recover your embedded images at Base64 to image decoder — from embedded data URI to standalone image file. 250,000 images. One decoder.

Tools mentioned in this article

Share this tool