Convert an image to Base64
Encode any image as raw Base64 or a ready-to-paste data URI — with the exact size overhead and snippet helpers. Nothing is uploaded.
Last reviewed . Runs locally — your images never leave your device.
How it works
- Drop an image file.
- Copy the raw Base64 string or the full data URI for your language of choice.
- Check the size math: Base64 adds about 33% over raw bytes; the exact numbers are shown.
Supported formats
Any image the browser can read: JPEG, PNG, WebP, AVIF, GIF, BMP.
Keep data URIs under roughly 2 MB of source image for sane HTML output.
Privacy
Everything happens in your browser: the image is decoded, transformed and encoded locally. Nothing is uploaded, and no filename, pixel data or metadata is sent anywhere. Read more on the privacy page.
Technical methodology
- Encoding is done with the FileReader Base64 pipeline locally; the output string is byte-exact with standard Base64 (no line breaks in the copied value).
- Data URI format: data:[mime];base64,[payload] — the MIME type is detected from file content, not the extension.
- Size overhead note: Base64 encodes 3 bytes into 4 characters, hence ~33% growth (plus the data URI header).
Known limitations
- Huge images inlined as data URIs make HTML/CSS heavy; prefer files + caching for production assets.
- Some environments cap string length; browsers handle multi-megabyte strings but editors may not.
Frequently asked questions
Is my image uploaded to a server?
No. The conversion runs in your browser with the standard FileReader API — useful when the file never should leave your machine.
When should I use a data URI instead of a file?
For small UI images, icons or single-file HTML/CSS where caching does not apply. For anything above roughly 10–20 KB, a separate file is usually faster to load.
Why is Base64 bigger than the file?
Base64 maps every 3 binary bytes to 4 text characters — about 33% larger. The tool shows the exact before/after byte counts.