How to use the Image to Base64
- Upload an image
- Copy the Base64 string, HTML or CSS snippet
- Or paste Base64 to decode it into an image
Images as text, and back
Base64 turns an image file into plain text, so it can be embedded directly in HTML, CSS, JSON or an email without a separate file. This tool works both ways: Image โ Base64 to encode, and Base64 โ Image to turn a string back into a picture. PNG, JPG, GIF, WebP and SVG are supported.
Outputs you can copy
- The raw Base64 string.
- A data URL starting with
data:image/png;base64,, which works anywhere a URL does. - A ready
<img src="โฆ">tag for pages that must be a single file. - A CSS
background-imagesnippet.
When to use Base64 images
Good for small icons, email signatures and templates, Markdown documents, and offline single-file pages. Avoid it for large photos: Base64 is about 33% bigger than the original file and can't be cached separately by browsers.
In Python, base64.b64encode(open("logo.png","rb").read()).decode() does the same job in a script.
Frequently asked questions
Is there a file size limit?
There is no fixed limit, but very large files depend on your device's memory and speed. Files up to a few hundred MB usually work well on a modern computer.