Image to Base64 Converter
Convert images to Base64 encoded strings for embedding in HTML, CSS, or emails.
About Image to Base64
Upload any image to get its Base64 encoded data URI, ready to embed in HTML or CSS. Processing happens entirely in your browser.
About this calculator
Upload an image and get the Base64 data URI, ready for HTML, CSS or an email template.
Check the size: Base64 is about a third larger than the file, so this suits small images best.
How to use it
- Choose an image file.
- Copy the generated data URI.
How it works
A data URI embeds a file in text: data:image/png;base64,iVBOR…. The browser decodes the string back into the image, so no separate request is needed. Base64 makes the data about 33% larger, so embedding pays off only for small images (a few KB), such as icons and tiny logos.
Worked example
Size
| 3 KB icon | about 4 KB as Base64 |
| 300 KB photo | about 400 KB as Base64, too big to inline |
Tips and common mistakes
- Inline only small images. Large ones slow the page and cannot be cached separately.
- SVG icons can often be used as plain text in a data URI without Base64.
- Compress images before encoding.
- Data URIs work in HTML img tags, CSS backgrounds and emails (with varying support).
- For repeated use, a normal image file is cached by the browser and is usually better.
Frequently asked questions
What is a Base64 image?
An image encoded as text and embedded directly in HTML or CSS.
When should I use a data URI?
For tiny icons that you want without an extra request.
Does it work in email?
Support varies; many email clients block data URIs.
Why is the string so long?
Base64 adds 33% and images are large.
Can I decode back to an image?
Yes, paste the string into the decode box and preview.
Is my image uploaded?
No, it stays in your browser.