CODDY Tool

Image to Base64

Convert an image into a Base64 data URI for use in CSS, HTML or JSON.

Encode images as Base64 strings and copy them as a raw string, a data URI, an HTML img tag or a CSS background rule — ready to paste straight into your code.

Your files are processed locally in your browser and are never uploaded to our servers.

Loading tool…

About Image to Base64

Base64 encodes binary data using only printable ASCII characters, which lets an image travel through channels that expect text — a CSS file, an HTML attribute, a JSON payload or an email body. Wrapped in a data URI, the encoded image becomes a self-contained string that a browser can render with no separate file and no network request.

The usual reason to do this is to eliminate an HTTP request for a very small asset: an icon, a texture, a one-pixel gradient. Inlining it means the image arrives with the stylesheet or document rather than needing its own round trip.

Base64 costs about 33% in size, because three bytes of binary become four characters of text. That overhead is trivial for a 2 KB icon and ruinous for a 2 MB photograph, which is why this technique is worth using only on genuinely small files.

How to convert an image to Base64

  1. Add an image

    Drag and drop a file or tap Select Images. Files up to 10 MB are accepted, though small images are the sensible use case.

  2. Choose an output format

    Switch between a raw Base64 string, a data URI, an HTML img tag or a CSS background-image rule.

  3. Copy or download

    Copy the string to your clipboard with one press, or download it as a text file if it is long.

When inlining is worth it

  • Small icons and logos under roughly 5 KB used in a stylesheet.
  • Images embedded in HTML email, where external images are often blocked by default.
  • Single-file HTML documents, reports and exports that must work with no accompanying assets.
  • Placeholder images inlined into JSON or a configuration file.

When to avoid it

Inlined images cannot be cached separately. A normal image file is downloaded once and reused across every page; a Base64 image is re-downloaded with every document that contains it, and it inflates the HTML or CSS that carries it.

Large inline images also block rendering: the browser must parse the entire string before it can paint the stylesheet or document. As a rule of thumb, do not inline anything above about 10 KB.

Frequently asked questions

What is a data URI?

A data URI packages a file's contents directly into a URL. It looks like data:image/png;base64,iVBORw0… — the MIME type, the encoding, then the encoded bytes. Browsers treat it exactly like a link to a file, so it works in an img src, a CSS url() or a link href.

Why is the Base64 string bigger than the file?

Base64 represents every three bytes of binary as four ASCII characters, so the encoded form is roughly 33% larger, plus a few bytes of prefix. That is inherent to the encoding, not something a tool can optimise away.

Does Base64 encoding compress or encrypt the image?

Neither. It is a reversible representation change, nothing more. Anyone can decode the string back into the original image, so never treat Base64 as any kind of security measure.

What size image is too big to inline?

Above roughly 10 KB the trade-off usually turns negative. Beyond that, the caching you lose and the parse cost you add outweigh the saved request. Compress and resize the image first — a properly sized icon is often small enough to qualify.

Can I convert Base64 back into an image?

Yes. Paste the string into the Base64 Decoder, or simply open a data URI directly in your browser's address bar to see the image.

All Image Tools

Image to Base64 is free to use with no account, no watermark and no usage limits. Last updated 13 August 2026.