Image to Base64

Turn an image into a data URI you can paste straight into CSS or HTML.

Drop an image here, or click to browse Encoded on your device, never uploaded

The image is decoded and processed by your own browser. It is never uploaded, and no copy of it exists anywhere but this tab, you can confirm that in the DevTools Network tab while you work.

Choose an image to encode.


, Original file
, Encoded size
, Overhead
, Worth inlining?
Preview
Encoded image preview
The data URI will appear here.

Features

  • Six output formats including CSS and Markdown
  • Size comparison showing the encoding overhead
  • A clear verdict on whether inlining is worthwhile
  • Live preview of the encoded result
  • Works with any image format your browser can read

How to use it

  1. Drop in the image you want to encode.
  2. Choose the snippet format you need.
  3. Check the verdict, small images are worth inlining, large ones are not.
  4. Copy the result into your code.

When inlining an image is worth it

Base64 encoding represents binary data using 64 printable characters, storing 6 bits per character instead of 8. That means the encoded output is always about 33% larger than the original, plus a few bytes of padding. Nothing is compressed, you are trading size for the ability to embed the image directly in text.

The trade is worthwhile when the request overhead exceeds the size penalty. Each HTTP request carries latency, and on a high-latency connection a round trip can cost 100 milliseconds or more regardless of how small the file is. For an icon of a few hundred bytes, inlining removes that entirely. The usual guidance is to inline anything under roughly 2 to 4 KB.

Above that, inlining actively hurts. An inlined image cannot be cached separately from the document, so it is re-downloaded on every page load rather than served from cache. It bloats your HTML or CSS, which are typically render-blocking, delaying first paint. And it cannot be lazy-loaded or served in a different format to different browsers. HTTP/2 and HTTP/3 multiplex requests over a single connection, which has substantially reduced the cost of extra requests and correspondingly reduced the case for inlining at all.

Frequently asked questions

Yes, completely. Image to Base64 is free with no usage limits, no account and no sign-up. There is no paid tier and no trial that expires. Tools marked Premium on this site carry that label to indicate a deeper feature set, not a price.
Image to Base64 covers six output formats including CSS and Markdown, size comparison showing the encoding overhead, a clear verdict on whether inlining is worthwhile, among other things. Everything is available immediately with no account, no sign-up and no usage limit.
Base64 encoding represents binary data using 64 printable characters, storing 6 bits per character instead of 8. That means the encoded output is always about 33% larger than the original, plus a few bytes of padding. Nothing is compressed, you are trading size for the ability to embed the image directly in text.
Your image is decoded and processed by your own browser using the File and Canvas APIs. It is never uploaded, there is no server to receive it. You can verify this by opening your browser's developer tools, switching to the Network tab, and watching while you use the tool: you will see no request carrying your file. Because nothing depends on a server, the tool also keeps working offline once the page has loaded, the site registers a service worker that caches it after your first visit.

Related tools

Further reading

📖 What Is a Base64 Image and When Should You Inline One?

Read the full guide on the 123MiniApps blog.

Pick a theme

Ten hand-tuned palettes.