How to convert an image to Base64
- Drop an image on the box or tap it to choose one. PNG, JPEG, GIF, WebP, SVG, ICO and AVIF all work.
- The Base64 data URI appears instantly, with a preview and the original and encoded sizes.
- Copy it as a plain data URI, a complete
<img src="…">tag, or a CSSbackground-image: url(…)declaration. - Untick Include data URI prefix if your API expects raw Base64 without
data:image/png;base64,.
When inlining images makes sense
A data URI embeds the image inside your HTML, CSS, JSON or email, so no separate request is needed. That is useful for tiny icons and logos, HTML email signatures, single-file reports and demos, placeholder images, and APIs that accept images as Base64 strings, such as many OCR and AI vision endpoints.
The trade-off is size: Base64 makes the image about 33% bigger, and inlined images cannot be cached separately by the browser. As a rule of thumb, inline images under about 4 KB and serve larger ones as normal files. For SVG icons, a URL-encoded SVG data URI is often even smaller than Base64.
Your images are read with the File API and converted on your device. They are never uploaded, so private screenshots and photos stay private.
FAQ
Why is the Base64 string so long?
Every 3 bytes of image data become 4 characters, so a 30 KB image becomes about 40,000 characters. Compress or resize the image first for a shorter string.
Do data URIs work in emails?
Support varies. Apple Mail and many mobile clients show them, but Gmail and Outlook often block them. For email, hosted images or attachments are more reliable.
Can I convert Base64 back to an image?
Yes. Use the Base64 to Image page, which previews the picture and lets you download it with the right file extension.