Image to Base64

Convert images locally to Base64, Data URL, HTML or CSS. Copy or download TXT while preserving original image bytes. No upload.

Drop one image here or paste an image

PNG, JPEG, GIF, WebP, AVIF, BMP, ICO · image ≤ 10 MiB · text ≤ 15 MiB · SVG unsupported

Your validated image preview will appear here.

Processing stays in your browser. Base64 is encoding, not compression or encryption. Original metadata is retained.

HTML and CSS output are text only. The decoder accepts plain Base64 or a base64 image Data URL.

Local processing, original bytes

Images are checked by file signature and browser decoding. The tool does not redraw images or remove metadata. Images that the browser cannot preview return an error.

Real examples

These files were processed with this tool or its shared processing code. Compare the source, settings and downloadable results.

Example 1PNG · 360 × 360 · 84625 B

Input

Image to Base64 — Example 1 — InputSource

Result

data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAWgAAAFoCAYAAAB65WHVAAAACXBIWXMAAAPoAAAD6AG1e1JrAAAgAElEQVR4nOy9dXCcV9…
Download
Example 2JPG · 480 × 320 · 47461 B

Input

Image to Base64 — Example 2 — InputSource

Result

data:image/jpeg;base64,/9j/2wBDAAQDAwMDAgQDAwMEBAQFBgoGBgUFBgwICQcKDgwPDg4MDQ0PERYTDxAVEQ0NExoTFRcYGRkZDxIbHRsYHRYYG…
Download
Example 3GIF · 400 × 240 · 70613 B

Input

Image to Base64 — Example 3 — InputSource

Result

data:image/gif;base64,R0lGODlhkAHwAPcAAAAAAPhzFvhzFvhzFvhzFvhzFvhzFvhzFvhzFvhzFvhzFvhzFvd0GPR3He98Ju5/Ku2AK+uBLumDMe…
Download
Example 4WEBP · 640 × 960 · 24796 B

Input

Image to Base64 — Example 4 — InputSource

Result

data:image/webp;base64,UklGRtRgAABXRUJQVlA4IMhgAADwPAKdASqAAsADPmEwlUgkIqmrovJo6XAMCWltOLHfj13KJ/A8OJKXN4XU5j7HWvM//…
Download

How to use this tool

  1. Choose an image

    Upload, drop or paste one supported image up to 10 MiB.

  2. Review the result

    The browser checks the actual image before showing a preview. Choose plain Base64, Data URL, HTML or CSS.

  3. Copy or save

    Copy the encoded text or download the full output as a TXT file.

Frequently asked questions

Are my files uploaded?

No. Encoding, decoding and preview validation run locally in your browser.

Does Base64 compress or encrypt an image?

No. Base64 is a text encoding and usually makes binary data about one third larger, before any prefix. It does not encrypt the file.

Are animation, transparency and metadata preserved?

The tool preserves the original bytes instead of redrawing the image. Animation, transparency and existing metadata remain in those bytes. Browser preview support can vary.

What inputs are supported?

PNG, JPEG, GIF, WebP, AVIF, BMP and ICO, up to 10 MiB. Decoding accepts plain standard or URL-safe Base64 and base64 image Data URLs, with up to 15 MiB of input text. SVG, HTML snippets and CSS snippets are not decoded.