Base64 Image Encoder — Free Online Image to Base64 Data URI

Convert images to Base64 data URIs for embedding in HTML/CSS, and decode Base64 images back to downloadable files — 100% client-side with live preview.

100% Client-Side — Your data never leaves your browser
🖼️
Click to upload an image (PNG, JPEG, GIF, WebP, SVG)

Frequently Asked Questions

Base64 Images: Data URIs for HTML and CSS

A Base64 image data URI embeds image data directly in your HTML or CSS, eliminating an HTTP request. The format is data:MIME_TYPE;base64,BASE64_DATA. For a PNG image:data:image/png;base64,iVBORw0KGgo.... You can use this directly as ansrc attribute or CSS background-image value.

The trade-off: embedding a Base64 image increases its size by ~33% and prevents browser caching of the image independently from the HTML. For small, infrequently-changing images like icons (under 5-10KB), the saved HTTP round-trip outweighs the overhead. For larger or frequently-updated images, external URLs are better.

Common use cases: embedding a site logo or favicon in an email template (which can't reference external images), inline SVG icons in CSS frameworks, small loading spinners and UI icons in single-file HTML documents, and data URIs in PDF-generating tools.

Related Tools