JSON Parser

Image to Base64 Converter

Drop an image to get its Base64 data URI, the raw Base64 string and ready-to-paste HTML and CSS snippets. Or paste a Base64 string to preview the image and download it. Files are read in your browser and never uploaded.

How to convert an image to Base64

  1. Drag an image onto the drop area, or click it to choose a file (PNG, JPG, GIF, WebP or SVG, up to 10 MB).
  2. Copy the format you need: the full Data URI, the Base64 only string, an HTML <img> tag or a CSS background declaration.
  3. To go the other way, paste a data URI or a Base64 string into Base64 → Image to preview it, then click Download image.

What is a data URI?

A data URI embeds a file directly in text, so a page can include an image without a separate request. It looks like this:

data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA...

The part before the comma says the type (image/png) and the encoding (base64); the rest is the image bytes written as Base64. You can use it anywhere a URL is accepted:

<img src="data:image/png;base64,..." alt="icon">

.logo { background-image: url("data:image/png;base64,..."); }

When to use Base64 images, and when not to

Good fitPoor fit
Small icons and tiny logos (a few KB)Photos and large images
Single-file HTML pages and demosImages used on many pages (they can't be cached separately)
CSS you want to ship in one fileContent where file size or page speed matters most
Quick prototypes and test dataEmail, where some clients block data URI images

Base64 makes data about 33% larger than the original file, and the tool shows the exact increase for your image. Inlining also stops the browser caching the image on its own, so keep embedded images small.

Decoding Base64 back to an image

Paste a full data URI to preview it as-is. If you paste only the Base64 characters with no data: prefix, the tool previews them as a PNG; if your image is another type and doesn't appear, paste the complete data URI so the correct type is included. Use the preview to confirm the image is intact before you save it.

Related tools

Encode or decode any text with Base64 Encoder / Decoder, put a link on a poster with the QR code generator, or minify the CSS that contains your data URI with the CSS minifier.

Frequently asked questions

When should I use a Base64 data URI?
For small images such as icons, where saving a network request outweighs the roughly 33% size increase. For large images, a normal file is better.
Which image formats are supported?
Any format your browser can display, including PNG, JPG, GIF, WebP and SVG.
Is my image uploaded?
No. The file is read with your browser's FileReader and converted locally. Everything runs in your browser — nothing you enter is uploaded to a server.
Handles JSON files up to 20MB smoothly