Base64 Image Converter

Embed small images directly in HTML, CSS, JSON or email templates as Base64 data URIs — or turn a Base64 string from an API response or stylesheet back into an image you can see and save. Both directions run entirely in your browser.

This tool runs entirely in your browser. Your files and text are processed on your own device and are never uploaded to our servers.

How to use the Base64 Image Converter

  1. Choose “Image → Base64” to encode, or “Base64 → Image” to decode.
  2. To encode, select an image (up to 5 MB). Pick the output: a full data URI, Base64 only, a CSS background rule or an HTML <img> tag.
  3. To decode, paste a data URI or plain Base64 text — even a whole <img> tag or CSS rule works — and select “Convert to image”.
  4. Copy the text or download the result. Decoded images are previewed so you can check them before saving.

Examples

A small icon as a CSS background

Input
icon.png (1.2 KB)
Result
background-image: url("data:image/png;base64,iVBORw0KGgo…");

Decoding an image from an API response

The image type is detected from the data itself, so a wrong or missing MIME type doesn’t matter.

Input
"avatar": "data:image/jpeg;base64,/9j/4AAQSkZJRg…"
Result
A JPG preview with its dimensions, ready to download as image.jpg

When to use Base64 images

Base64 turns binary image data into plain text, so an image can live inside an HTML, CSS or JSON file without a separate request. That suits small icons, tiny placeholders and HTML emails. The trade-off is size: Base64 text is about 33% larger than the original file, and embedded images can’t be cached separately by the browser, so larger images are better served as normal files.

Frequently asked questions

Is my image or data sent to a server?

No. Encoding and decoding happen locally in your browser; nothing is uploaded.

What is a data URI?

A data URI is text in the form data:[type];base64,[data] that browsers treat like an image URL. You can use it in an <img> src attribute or a CSS url() value.

Why does decoding say my text isn’t valid?

Base64 only uses letters, digits, +, / and = (or - and _ in the URL-safe variant). Copying from logs or JSON sometimes adds quotes, escaped characters or cuts the text short. Make sure you copied the complete value.

Which image types are supported?

PNG, JPG, WebP, GIF, BMP, AVIF and SVG, in both directions.

Everything you need. One simple place.

Free, fast online tools for text, PDFs, images, data and everyday maths. Every tool runs entirely in your browser, so your files stay on your device.

  • Privacy-first processing
  • No sign-up required

© 2026 Toolora. All rights reserved.

Built for speed and privacy