To get an image's Base64: drop it in the box above and copy the format you need. The data URI (data:image/png;base64,…) works directly in <img src> and CSS url().
When Base64 makes sense, and when a link is better
| Use Base64 for | Use a link for |
|---|---|
| Tiny icons and logos inside HTML, CSS or emails | Photos and anything over about 100 KB |
| API requests that expect Base64 image data | Sharing an image with people or an AI chat |
| Test data and single-file HTML pages | Images that should be cached by the browser |
Pasting a long Base64 string into an AI chat wastes most of its context window and usually works worse than giving it the image itself. Upload the picture or turn it into a link instead.
Making it smaller first helps too: compress the image before encoding.
We tested it
Our 25.4 KB logo (26,022 bytes) became 34,696 Base64 characters, plus the 22-character data:image/png;base64, prefix. That's exactly 4 characters for every 3 bytes: 33% bigger. On a web page, that extra third is downloaded with the HTML every time instead of being cached as a separate file, so Base64 pays off for icons of a few KB, not for photos.