Image to Base64
Convert image files to Base64 data URIs and decode Base64 back to images.
Examples
| Input | Result |
|---|---|
| A small 2 KB favicon.png | data:image/png;base64,iVBORw0KGgo... (approx 2.7 KB string) |
| A 16x16 icon converted for embedding in CSS | background-image: url(data:image/png;base64,...) ready to paste |
| A Base64 string pasted into the decoder | Reconstructed image available for download |
| A 50 KB SVG logo encoded for inline use in HTML | data:image/svg+xml;base64,... string |
About this tool
Base64 encoding converts binary image data into a plain text string made up of letters, numbers, and a few symbols. The resulting data URI can be dropped directly into HTML img tags, CSS background-image properties, or JSON payloads without needing a separate file. This is handy for small assets like icons or logos where eliminating an extra network request is worth the tradeoff.
Keep in mind that Base64 adds about 33% to the data size, and the encoded string cannot be cached independently by browsers the way a separate image file can. For anything larger than a few kilobytes, serving a regular image file is usually the better choice. This tool handles both encoding (image to Base64) and decoding (Base64 back to image) entirely in your browser using the FileReader API.
Frequently asked questions
Why is the Base64 string larger than the original file?
Base64 encoding represents binary data using only printable ASCII characters. This encoding overhead increases the data size by about 33%. A 3 KB image becomes roughly a 4 KB Base64 string.
When should I use Base64 images instead of regular files?
Base64 is useful for very small images like icons or tiny logos where you want to avoid an extra HTTP request. For larger images, a normal file is almost always better because Base64 strings bloat your HTML or CSS and cannot be cached separately.
Can I convert a Base64 string back to an image file?
Yes. This tool supports both directions. Paste a Base64 data URI into the decoder and it will reconstruct the original image for you to preview and download.
