Mode
Output

Drop an image here

or click to choose · or paste (Ctrl/Cmd + V)

processed in your browser · never uploaded

Drop or paste an image to get its Base64.

Encoding/decoding runs in your browser. Images are never uploaded.

A two-way converter between image files and Base64 (data URIs). In "Image → Base64" mode, drag and drop an image (or click to choose, or paste with Ctrl/Cmd+V) — PNG, JPEG, WebP, GIF, BMP, or SVG — and it produces a data URI like `data:image/png;base64,iVBORw0KGgo...`. You can choose from four output formats: "Data URI" gives the full string you can drop straight into a `src` attribute; "Base64 only" strips the `data:...;base64,` prefix to give the raw Base64; "CSS" wraps it as a `background-image: url("...")` declaration; and "HTML <img>" gives a complete `<img src="...">` tag — so you just copy the form you need and paste. After converting, it also shows the original file size and the approximate Base64 size (Base64 makes data roughly 1.37× larger), so you can judge whether inlining is reasonable. This is handy for inlining small icons or logos into CSS, HTML, email, or JSON to cut HTTP requests, or for bundling data into a single piece of text. In "Base64 → Image" mode, paste either a `data:` URI or a bare Base64 string and it reconstructs the image for preview and download. When there is no prefix, it sniffs the leading magic-number bytes to detect PNG, JPEG, GIF, WebP, BMP, or SVG automatically. Use it to check whether a data URI you received is really an image, or to recover a Base64 blob embedded in source. Importantly, the image or Base64 you enter is never uploaded, stored, or sent to a server — all processing happens with JavaScript entirely inside your browser, so images you can't share externally stay on your device. Note that this tool focuses on Base64 conversion; it does not resize, compress, or re-encode images, nor does it do URL percent-encoding of text (use the dedicated tools for those).

How to use

  1. Pick a mode — "Image → Base64" or "Base64 → Image".
  2. Encode: drop, choose, or paste an image to see its Base64. Pick an output format (Data URI / Base64 only / CSS / HTML) and copy it.
  3. Decode: paste a data URI or raw Base64 to preview and download the image. Your input is never sent anywhere.

FAQ

Is the image or Base64 I enter uploaded anywhere?

No. All conversion happens with JavaScript (FileReader) inside your browser, and the image or Base64 string is never uploaded, stored, or sent to a server. Images you can't share externally stay entirely on your device.

What is the difference between "Data URI" and "Base64 only"?

"Data URI" is the full string like `data:image/png;base64,...` including the MIME type and prefix, ready to use in a `src` attribute or CSS `url()`. "Base64 only" is the raw Base64 without that prefix, for when you want to add the MIME yourself or hand the data to another system.

Can it decode Base64 that has no data: prefix?

Yes. Even for a bare Base64 string with no `data:` prefix, it sniffs the leading bytes (the magic number) of the decoded data to detect PNG, JPEG, GIF, WebP, BMP, or SVG and rebuilds the image. If it can't tell, it tries PNG.

How does Base64 affect file size?

Base64 represents binary as text, so the result is about 33% larger (roughly 1.37×) than the original. The tool shows the original size and the approximate Base64 size after converting, so you can judge whether inlining is worthwhile. It's best for small icons and logos, not large photos.

Can it resize or change the image format too?

No. This tool focuses on converting between an image and Base64 (a data URI). It does not resize, compress, or change formats — use a dedicated tool for that. URL percent-encoding of text is also a separate tool.