Image to Base64 Converter
Convert images to Base64 Data URLs for embedding in HTML, CSS, and JavaScript. Instant conversion, no upload. For developers.
For logos and icons, a vector file can beat any encoded image.
When should you use SVG instead?Drop image to convert to Base64
JPG, PNG, WebP, SVG, GIF supported - or click to browse
→ Reverse: Base64 to Image
Paste a Base64 string or Data URL below to preview and download as an image.
How much bigger does Base64 make an image?
About a third bigger, every time. Base64 turns every 3 bytes of the file into 4 text characters, so the encoded version is 1.33 times the size of the original. We checked it on three files. A 219.3 KB PNG became 299,424 characters. A 29.6 KB WebP became 40,428. A 339.2 KB JPG became 463,104. The ratio was 1.333 in each case. The full data URL adds a short prefix such as "data:image/png;base64," on top.
When is Base64 actually worth it?
- Tiny icons and logos of a few kilobytes, where saving a separate download matters more than a third more bytes.
- HTML email templates and one-file documents that have to travel without separate image files. Some email clients block embedded images, so test before sending widely.
- Test data and prototypes, where pasting a string into code is quicker than hosting a file.
It's a poor choice for photos. A 339 KB photo turns into almost half a megabyte of text inside your HTML or CSS. The browser can't cache it separately from that file, and it can't start loading it in parallel. For anything bigger than a small icon, link to a normal image file, and compress it first with the image compressor.
What formats do you get?
Four copy-ready versions of the same encoding: the full data URL, the raw Base64 string, a CSS background-image rule and an HTML img tag. The boxes on screen only show the first part of long strings to keep the page usable. The copy buttons copy the complete value. Any image type your browser recognises can be encoded, and the file never leaves your device.
Can you turn Base64 back into an image?
Yes. Paste a data URL or a raw Base64 string into the decoder box. If you paste a raw string, the tool works out the image type and wraps it for you. You'll see a preview, and you can download the decoded file. If the text isn't a valid image, it says so instead of producing a broken file.
Does encoding change the image?
No. Unlike the other tools on this site, this one doesn't redraw anything on a canvas. It reads the original bytes and encodes them as they are, so the image, its quality and any metadata inside the file are untouched. That also means EXIF data such as GPS location stays in the encoded string. Strip it first with the resizer or compressor if that matters.
How we tested: we ran this page's own code in headless Chromium using Playwright on public test images (an 800 x 600 transparent PNG, a 550 x 368 WebP photo and a 1800 x 1200 JPEG photo), and every row in the table below comes from one of those runs.
| Sample | Setting | Before | After | What we saw |
|---|---|---|---|---|
| Transparent PNG | Encode | 219.3 KB (224,566 bytes) | 299,424 characters | Ratio 1.333 |
| WebP photo | Encode | 29.6 KB (30,320 bytes) | 40,428 characters | Ratio 1.333 |
| JPEG photo | Encode | 339.2 KB (347,327 bytes) | 463,104 characters | Ratio 1.333 |