Which image tool do I need
| Your task | Tool |
|---|---|
| Any image to Base64 or a data URI | Image to Base64 |
| Paste Base64 and see the picture | Base64 to image |
| Logos, screenshots, transparency | PNG to Base64, Base64 to PNG |
| Photos | JPG to Base64, Base64 to JPG |
| Smaller files for the web | WebP to Base64, AVIF to Base64, Base64 to WebP |
| Animations | GIF to Base64, Base64 to GIF |
| Vector icons in CSS | SVG to Base64, or the usually shorter SVG data URI |
| Inspect an SVG from Base64 safely | Base64 to SVG |
| An inline favicon | Favicon to data URI, Base64 to ICO |
| iPhone photos, scans, legacy bitmaps | HEIC to Base64, TIFF to Base64, BMP to Base64, Base64 to BMP |
The encoders share one set of outputs: plain Base64, data URI, CSS background-image, HTML <img> with width and height, Markdown, and a JSON object with name, type and size. You can drop several files at once or paste a screenshot with Ctrl+V.
Choosing the format before you encode
Base64 makes every image a third larger, so the format decides most of the final length.
- PNG for flat graphics, UI elements and anything with transparency or text.
- JPEG for photos, where a PNG would be several times larger.
- WebP for both cases when the target supports it; it is usually the smallest of the three.
- SVG for icons and logos that are vector drawings. As a URL-encoded data URI it is often shorter than Base64, which the SVG data URI tool compares side by side.
- HEIC and TIFF are encoded as they are. Most browsers cannot display them, so convert to JPEG or PNG first if the result has to show in a web page.
Recognizing image Base64
| Prefix | Format |
|---|---|
iVBORw0KGgo | PNG |
/9j/ | JPEG |
R0lGODlh / R0lGODdh | GIF |
UklGR | RIFF container: WebP, but also WAV audio |
PHN2Zy / PD94bWwg | SVG starting with <svg or <?xml |
AAABAA | ICO |
Qk | BMP |
A full data URI adds the MIME type in front, as in data:image/png;base64,iVBORw0KGgo…. The decoders accept both forms, and also strings pasted together with the surrounding CSS or HTML. If the string turns out not to be an image, Base64 to file identifies other formats, and the file tools cover PDFs, audio, video and documents.
FAQ
How do I know which image format a Base64 string contains?
Look at the first characters: iVBORw0KGgo is PNG, /9j/ is JPEG, R0lGOD is GIF, UklGR is a RIFF container such as WebP, and PHN2Zy or PD94bWwg is usually SVG. Base64 to image detects the type for you.
Can I shrink an image before encoding it?
Yes. The PNG, JPG, WebP, GIF, BMP and AVIF converters, and the general image encoder, can resize to a maximum width, re-encode as PNG, JPEG or WebP with a quality slider and strip EXIF metadata, all in the browser.
Should small icons be inlined as Base64?
For a few small icons, inlining saves requests. Larger images are better as files: Base64 adds a third to the size and the data cannot be cached separately from the page. Data URI performance has the numbers.