TontonTools

Image to Base64

Convert images to Base64 — embed pictures directly in code and CSS.

100% Free No signup Privacy-friendly Image Tools
Updated Sep 2026

Drag & drop an image here, or

Share X / Twitter Facebook LinkedIn WhatsApp

How to use Image to Base64

  1. Upload the image — small files inline best.
  2. Copy the data URI — the full data:image/…;base64,… string.
  3. Embed it: src="data:…" in HTML, url(data:…) in CSS, or as a JSON string value.
  4. Respect the size rule — icons yes, photos no; past ~20 KB, host the file instead.

What is Image to Base64?

An image to Base64 converter encodes an image file as text — the data URI (data:image/png;base64,iVBORw0…) that embeds the picture directly inside HTML, CSS, JSON or JavaScript instead of referencing a separate file. The image becomes part of the code.

The trade is requests versus bytes: an inlined image saves an HTTP request (once meaningful, less so under HTTP/2+) but costs ~33% size overhead (Base64's encoding tax) and loses independent caching. The sweet spot is small: icons, tiny logos and placeholder images under a few KB inline well; photos don't.

About the Image to Base64

Upload the image and copy its Base64 data URI.

Where inlining earns its place: small icons and decorations in CSS (one stylesheet, zero extra requests — the classic use), self-contained single-file HTML (email templates where linked images get blocked, offline documents, code demos in sandboxes), images inside JSON payloads (APIs and configs that must carry a picture in text), and quick prototyping without asset hosting. The email case is prominent: embedded images display without the "load images?" gate — though size discipline matters doubly there.

The judgment rule: under ~5 KB, inline freely; 5–20 KB, consider; beyond, host the file — the 33% overhead plus lost caching outweigh the request saved. And note data URIs bloat the containing file visibly: a stylesheet carrying ten inlined icons wears them in its size. Files are converted and returned, not stored.

Frequently Asked Questions

Encoding overhead — Base64 represents 3 bytes as 4 characters, a fixed +33%. It's the tax for existing as text; gzip on the containing file claws some back.
Small and few: icons in CSS, logos in self-contained HTML/emails, images in JSON. The request saved beats the byte overhead only below roughly 5-20 KB per image.
In many clients yes (and they bypass image-blocking), but support is patchy — Outlook notoriously balks. Email convention remains hosted images with alt text; inline for controlled contexts.
Only as part of the containing file — the image can't be cached, lazy-loaded or CDN'd independently. That coupling is the hidden cost that rules out inlining anything sizable.
background-image: url("data:image/png;base64,…") — quoted, inline in the property. SVG icons inline especially well (often smaller as raw SVG text than Base64, worth comparing).

Learn more

How to Convert an Image to a Base64 Data URI

Embedding small images directly in code can save HTTP requests. Here is how Base64 image conversion works — and when to use it.

Read the guide

We use cookies for analytics and to keep the tools free via ads. See our Privacy Policy.