📷

Image to Base64 Encoder

Convert images to Base64 data URIs for embedding directly in HTML or CSS. Free, private.

🖼️ Image Tools Free Browser-based
Tool

What Is a Base64 Data URI?

A data URI embeds a file's contents directly into HTML or CSS as a text string: data:image/png;base64,iVBORw0KGgo…. The browser reads the string and renders the image without an extra HTTP request.

When to Use Base64 Embedding

Best for small, frequently used assets — SVG icons, tiny decorative images, email templates, or offline single-file HTML pages. Avoid embedding large photos: a 500 KB JPEG becomes ~667 KB as Base64 and cannot be cached separately.

Image SizeRecommendation
Under 5 KB (icons, favicons)Safe to embed as Base64
5–20 KB (small graphics)Consider case-by-case
Over 20 KB (photos)Use external file + CDN

How to Use the Output in HTML and CSS

After converting, paste the data URI directly into your code:

ContextSyntax
HTML img tag<img src="data:image/png;base64,iVBOR…">
CSS backgroundbackground-image: url("data:image/png;base64,iVBOR…");
HTML emailUse as an <img src> attribute — external images are often blocked by email clients
Inline SVGUse SVG's <image xlink:href="data:image/png;base64,…">

📖 Embed Images in HTML Without External Files

Frequently Asked Questions