Skip to content
Jellykit

Image to Base64

Turn an image into a Base64 data URI with a ready-to-paste HTML img tag, CSS background rule and raw Base64 text.

  • Runs on your device
Loading tool

About Image to Base64

Embedding a small icon, logo or placeholder straight into HTML, CSS, an email template or a JSON file saves a separate download. Drop an image and copy whichever form you need: the full data URI, an img tag with your alt text, a CSS background-image rule or the bare Base64.

The MIME type is read from the file’s own bytes rather than its name, so a PNG that was renamed .jpg is still labelled correctly. The page also shows how much larger the text is than the file, and warns when an image is big enough that a separate file would serve better.

How it works

  1. The file is read on your device and its first bytes are checked to tell which image format it really is.
  2. Its bytes are encoded with the standard Base64 alphabet (RFC 4648), with = padding and no line breaks, and prefixed with data:, the MIME type and ;base64, to make the data URI.
  3. The HTML tag escapes your alt text so quotes and angle brackets cannot break the markup.

Questions

How much bigger does an image get?

Base64 turns every 3 bytes into 4 characters, so the text is about 33% larger than the file, plus a short prefix. The page shows the exact figure for your image.

Is there a size limit?

Files up to 2 MB are taken. Past about 10 KB the page suggests a separate file instead, because a large data URI cannot be cached on its own and slows down the page or stylesheet that holds it.

Is the image changed or compressed?

No. The file’s bytes are encoded exactly as they are. To make the result shorter, compress or resize the image first.

Can I decode Base64 back into an image?

Not on this page. The Base64 tool decodes text back into the original bytes.

Everything you enter here is processed in this browser tab. Nothing is uploaded, logged or shared. How privacy works here.