Image to Base64 Converter
Convert an image to a base64 data URI, or decode base64 back into an image, in either direction. Runs entirely in your browser; nothing you upload or paste is ever sent anywhere.
Drop an image here, or click to choose one
Quick Learn
Base64 turns arbitrary binary data — like an image's raw bytes — into plain text made up of only letters, digits, and a couple of symbols. That's useful anywhere binary data needs to travel through a text-only channel: embedded directly in CSS (background-image: url(data:image/png;base64,...)), inlined in HTML, or stored in a JSON field, all without a separate file request.
The cost is size: base64 text is about a third larger than the binary it represents, because it spends 8 bits of text to represent 6 bits of the original data. That trade-off usually makes sense for small icons and inline assets, and rarely makes sense for full-size photos, where the extra size and losing browser caching (the data is baked into the page itself, not fetched separately) outweigh the convenience. Everything here runs locally in your browser — nothing you upload or paste is sent anywhere.
Best Practices
- •Reserve base64-embedded images for small, single-use assets (icons, tiny UI graphics) — a browser can't cache an inline data URI separately from the page that contains it, unlike a normal image file.
- •A full data URI (data:image/png;base64,...) is what CSS and HTML expect directly; the raw base64 (no prefix) is what most APIs and JSON payloads expect — this tool gives you both so you don't have to strip or add the prefix by hand.
- •If a pasted base64 string fails to render, check that it wasn't truncated — a common cause is copying from a source that cuts off long text, silently producing an incomplete (and undecodable) string.
- •When pasting raw base64 without a data: prefix, make sure the MIME type you select actually matches the original image format — a PNG's bytes decoded as a JPEG (or vice versa) simply won't render.
More Image & Media Tools
QR Code Generator
Generate a QR code from text, a URL, or anything else, with adjustable size and error correction.
Barcode Generator
Generate Code128, EAN-13, and other common barcodes.
Image Compressor
Shrink image file size without leaving your browser.
Image Format Converter
Convert between PNG, JPEG, and WebP.
Favicon Generator
Generate a full favicon set from one image.
SVG Editor
Edit, recolor, resize, optimize, and export SVG markup, with a live preview.
Frequently Asked Questions
Is my image uploaded or stored anywhere?
No. Encoding and decoding both happen entirely in your browser — nothing you upload or paste is sent to a server or stored anywhere.
What's the difference between the Data URI and the plain Base64 output?
The Data URI (data:image/png;base64,...) is a complete, self-contained reference you can drop directly into CSS or HTML. The plain base64 output is just the encoded bytes with no prefix — what most APIs and JSON fields expect when a field just wants "the base64 of the file."
Why is the base64 text bigger than my original image file?
Base64 encoding represents every 3 bytes of binary data as 4 characters of text, which inflates size by roughly 33% — an inherent cost of representing binary data as plain text, not something this tool adds on top.
Why did my pasted base64 fail to render as an image?
Usually either the base64 text is incomplete (truncated during copy/paste), contains characters that aren't valid base64, or the MIME type doesn't match what the bytes actually are. Double-check the string was copied in full.
Can I convert any image format?
Yes — the encoder just reads whatever bytes the browser gives it for the file, regardless of format (PNG, JPEG, WebP, GIF, SVG, etc.), so encoding works the same way for all of them.
Want the engineering deep-dives behind tools like this one?