Skip to content
Tool 03 / 04Runs locally

Image to Base64 Converter

Turn PNG, JPEG, WebP, or GIF images into Base64 data URIs—or restore an image from a data URI, raw Base64, or a Base64 text file. See dimensions, MIME type, and file size. All processing happens locally.

No uploads · no object storage

or drag and drop

PNG, JPEG, WebP, or GIF · up to 25 MB

Read locally with FileReader

Data URIs grow by roughly 33%. For large production assets, serve a normal image file instead.

Under the hood

How it works

No black box: every transformation on this page is a documented browser API running on your device.

Data URIs can be very large. Base64 adds about 33% overhead on top of the original file, so keep data URIs out of critical CSS and prefer normal image URLs for heavy production assets.

  1. 01

    Read the file locally

    The FileReader API converts the selected image into a data URI. The file never leaves the tab; there is no upload endpoint in this application.

  2. 02

    Inspect the real image

    The browser decodes the image to report its natural dimensions. The converter also normalizes the MIME type, byte size, and a readable file size.

  3. 03

    Reconstruct from Base64

    Paste a complete data URI or raw Base64, or choose a .txt, .base64, or .b64 text file. The decoder ignores whitespace, verifies the real file signature, and renders the bytes through a local Blob URL. Only PNG, JPEG, WebP, and GIF are accepted to avoid active SVG content.

Common questions

Frequently asked

Short answers about how image base64 works and where its limits are.

When should I use an image data URI?

Data URIs are handy for tiny icons, email templates, standalone HTML files, and quick prototypes. They increase document size by roughly one third and are not cached separately, so larger images are usually better served as files.

Which image formats are supported?

PNG, JPEG, WebP, and GIF are supported in both directions. SVG is intentionally excluded because SVG can contain scripts and external references, which is undesirable when pasting untrusted data.

Can I restore an image from a Base64 text file?

Yes. Choose or drop a .txt, .base64, or .b64 file containing either raw Base64 or a complete image data URI. You do not need to copy a huge string into the text box. The file is read locally, and the decoded image format is detected from its bytes.

Does the converted image keep its transparency?

Yes. The data URI preserves the original bytes exactly, including alpha transparency for PNG, WebP, and GIF. The tool does not recompress the image.

All processing happens locally in your browser.

Your tool input is never uploaded. Google AdSense supports the site and may use cookies for advertising.

Browse all tools