Convert an image to Base64
Drop an image above. You immediately get:
- Data URI:
data:image/png;base64,iVBORw0…, usable anywhere a URL is - Base64: just the encoded text, for APIs and JSON
- HTML:
<img src="data:…" alt="…" width="…" height="…"> - CSS:
background-image: url("data:…"); - Markdown:

Each has a Copy button. Very long results show a shortened preview, but Copy always copies the complete text, and you can also download it as a .txt file.
What Base64 encoding is
Base64 turns binary data into text using 64 safe characters. Every 3 bytes become 4 characters, so the encoded text is about 33 % larger than the file. In return it can travel anywhere only text is allowed: inside HTML and CSS files, JSON, XML, email bodies and environment variables.
A data URI adds the type in front: data:[MIME type];base64,[data]. Browsers treat it like a link to a file, except the file is embedded in the page itself.
Make the text shorter first
Every byte counts when an image is embedded in code. The settings can re-save the image before encoding:
- Format: Original (byte-for-byte), or WebP (usually the shortest for photos and graphics), PNG or JPG.
- Size: Original, or scale down so the longest side is 512, 256 or 64 pixels: perfect for icons and thumbnails.
The size before and after encoding is shown, with the +33 % overhead, so you can see the effect.
When to use Base64 images, and when not
Good uses:
- Small icons, logos and UI graphics (under ~10 KB)
- HTML emails, where linked images are often blocked
- Single-file HTML pages, offline documents, bookmarklets
- JSON APIs, config files and databases that only store text
- CSS sprites or placeholders that must render instantly
Avoid for:
- Photos and large images. They inflate HTML and CSS, can't be cached separately and delay rendering. Serve them as normal files (as WebP or AVIF; the Image Compressor helps).
SVG: URL-encoding beats Base64
SVG is already text, so Base64 just makes it a third longer. A URL-encoded data URI (data:image/svg+xml,%3Csvg…) only escapes the characters that need it and is usually shorter. Choose it under SVG data URI.
Private by design
The image is encoded on your device by your browser. Nothing is uploaded, which matters for unpublished designs and internal assets.