Image ⇄ Base64 Converter

Turn a small image into an inline data URI, or turn a data URI back into a file.

Drop an image here or click to choose a file — any image up to a few hundred KB

Runs in your browser. Everything you type or load here is processed locally by JavaScript on this page. Nothing is uploaded to Tooltrusty or to any third party.

What the image & Base64 Converter does

A data URI is a whole file written directly into a URL. Instead of src="logo.png", which makes the browser fetch a separate file, you write src="data:image/png;base64,iVBORw0KGgo..." and the image travels inside the HTML or CSS itself. Base64 is the encoding that makes that possible: it represents arbitrary binary data using only characters that are safe in a URL.

The trade-off is size. Base64 uses four characters for every three bytes, so an encoded image is about 33% larger than the file it came from, plus a small header. That is fine for something tiny and terrible for something large. The practical rule is to inline images under roughly 4 KB — small icons, a spinner, a texture, a placeholder — where saving an entire HTTP request outweighs the extra bytes, and to leave anything larger as a normal file that the browser can cache and load in parallel.

The encoder here gives you the output in four shapes: the bare data URI, a ready-made CSS background-image rule, a complete HTML <img> tag, or the raw Base64 payload without the data: prefix — that last one is what APIs and JSON fields usually expect. The decoder works in reverse: paste a data URI you have found in a stylesheet or an API response and get back a viewable, downloadable image.

Because encoding and decoding both happen in your browser, you can safely inspect data URIs that came out of internal systems without sending them anywhere.

How to use it

  1. On the Image → Base64 tab, drop in the image you want to inline.
  2. Choose the output shape: a plain data URI, a CSS rule, an HTML tag, or the raw payload for an API.
  3. Check the overhead figure — if the result is much over 4 KB, an ordinary image file is usually the better choice.
  4. To go the other way, switch tabs, paste a data URI and press Decode to preview and download it.

A worked example

A 620-byte SVG-derived PNG icon encodes to an 856-character data URI, a 38% increase. Inlined as CSS it becomes:

.icon-check {
  background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUg…');
  background-size: 16px 16px;
}

That saves one HTTP request on every page load, which on a high-latency mobile connection is worth more than the extra 236 bytes. Now compare a 180 KB hero photograph: encoded it becomes roughly 240 KB of text embedded in your HTML, it cannot be cached separately, it blocks the HTML from finishing, and it has to be re-downloaded on every page. That one stays a file.

Frequently asked questions

How much bigger does Base64 make my image?

About 33% larger, plus around 30 characters of header. Three bytes of binary become four characters of text, which is the fixed cost of representing binary data in a text-safe alphabet.

When should I inline an image instead of linking it?

When it is small (under roughly 4 KB), used on most pages, and saving a round trip matters more than caching. Icons and tiny textures qualify. Anything larger benefits more from being a separate cacheable file that loads in parallel.

Can I use data URIs in an email?

In HTML email, support is unreliable — several major clients, including some versions of Outlook, block or strip them. Use a hosted image with a normal URL for email, or a CID-attached image.

Is Base64 a form of encryption?

No. It is an encoding, not a cipher: anyone can decode it instantly, as this page demonstrates. It makes binary data safe to transport as text and offers no confidentiality whatsoever.