Image to Base64
Turn any image into a Base64 data URI with ready-to-paste HTML and CSS snippets - converted locally, never uploaded.
PNG, JPG, WebP, GIF, SVG or BMP - encoded locally on your device
Embed images straight into your code
A Base64 data URI packs an entire image into a single line of text that a browser can render
on its own, with no separate file to fetch. Paste it into an <img src>, a
CSS background-image, an email template or an SVG, and the picture travels with
the markup. This tool reads your file with the browser FileReader API and hands you the data
URI plus ready-made HTML and CSS snippets, each with one-click copy. Nothing is uploaded.
When inlining helps - and when it hurts
Inlining removes one network request, which is a real win for tiny, frequently used assets like icons, spinners or a subtle background pattern. But Base64 is about 33% larger than the original binary, and an inlined image cannot be cached separately from the page or reused across pages. As a rule of thumb, inline assets under roughly 5 to 10 KB and link to anything bigger. This tool warns you when your encoded string crosses 1 MB, where inlining is almost always the wrong call.
Keep the payload small first
Because the encoded text inherits your file size plus a third, it pays to shrink the image before encoding. Run it through the image compressor or the image resizer first, or convert a photo to WebP with the image converter to cut the byte count. For favicons and app icons specifically, the favicon generator produces every size you need in one go.