Skip to content

Image to Base64

Encode an image to a base64 data URI, or decode one back to an image.

  • Secure upload
  • Deleted after processing
  • No watermark

Click to upload or drag and drop

JPG, PNG, WebP, GIF or SVG — up to ~10MB (base64 works best on smaller files)

About the image to base64

This free online image to Base64 converter encodes a photo, icon or graphic into a Base64 data URI — the text-based format that lets an image be embedded directly inside HTML, CSS or JSON instead of loading as a separate file. It's a two-way tool: encode an image into Base64, or paste a data URI (or a bare Base64 string) back in to decode and download the original image, which most single-purpose converters don't offer.

Base64 encoding is a genuinely useful technique in specific, common situations: inlining a small icon or logo directly into a stylesheet so the browser doesn't need a second network request, embedding an image inside a JSON API payload or a generated email where a separate file isn't practical, or pasting a self-contained image straight into a codebase, a markdown file or a CSS `background-image` without managing an asset path. It's the wrong tool for large photos, though — Base64 text is roughly a third bigger than the original binary file, and every copy of that string gets re-downloaded and re-decoded on every page load, so this is best reserved for small, frequently-reused graphics rather than a general image-hosting substitute.

That trade-off is shown directly rather than left for you to discover later: a live readout compares the original file size against the encoded Base64 size and shows the exact percentage overhead, so you know upfront whether inlining is worth it for a given image. Once encoded, the result is available in four ready-to-use forms — the full data URI, the bare Base64 string on its own, a complete HTML `<img>` tag, and a CSS `background-image` declaration — each with its own one-click copy button, so there's no manual assembly required for whichever format the destination needs.

Everything happens locally in your browser using the standard FileReader API — nothing is ever uploaded to a server, so it's instant and safe to use on private or unreleased assets, with no upload and no server-side copy to worry about.

Key features

  • Two-way tool — encode an image, or decode a data URI/Base64 string back to an image
  • Live size comparison showing the exact Base64 overhead
  • Four ready-to-copy output forms: data URI, bare Base64, HTML tag, CSS snippet
  • Decode mode accepts a full data URI or a bare, whitespace-wrapped Base64 string

Common use cases

Inlining icons & small graphics

Embed a small logo or icon directly into a stylesheet or component, avoiding an extra network request.

APIs & generated documents

Include an image directly inside a JSON payload, a generated email, or a document format that doesn't support separate file attachments.

Quick sharing in code

Paste a self-contained image straight into a codebase, config file or markdown document without managing a separate asset.

Decoding a data URI

Recover and download the actual image file from a Base64 string or data URI you found in code, a browser inspector or an API response.

How to use it

  1. 1Upload an image to encode, or switch to "Base64 → Image" to decode one instead.
  2. 2Check the size comparison to see the Base64 overhead before using it.
  3. 3Copy the data URI, bare Base64 string, HTML tag or CSS snippet — whichever you need.
  4. 4Or paste a data URI/Base64 string into decode mode to preview and download the original image.

Supported formats & limits

Accepts JPG, PNG, WebP, GIF and SVG for encoding, up to roughly 10MB. Decoding accepts any valid image data URI or bare Base64 string.

Privacy & security

Encoding and decoding both happen locally in your browser using the FileReader API — nothing ever leaves your device.

FAQ

Is my image uploaded to a server?
No. Encoding and decoding both happen locally in your browser using the FileReader API — nothing ever leaves your device.
Why is the Base64 output so much bigger than my file?
Base64 encoding trades binary efficiency for text-safety, which adds roughly 33% overhead — the live readout shows the exact percentage for your file so you can judge whether inlining is worth it.
What formats can I copy?
The full data URI, the bare Base64 string with no prefix, a ready HTML <img> tag, and a CSS background-image declaration — each with its own copy button.
Can I convert a Base64 string back into a downloadable image?
Yes — switch to "Base64 → Image", paste a data URI or bare Base64 string, and a preview and download button appear automatically.