Image to Base64
Turn a picture into a data URI, plain Base64 or a CSS and HTML snippet, or turn Base64 back into a picture. Nothing is uploaded.
Image
Direction
What it does
Image to Base64 encodes a picture as text so you can paste it straight into a stylesheet, an HTML page, an email template or a JSON file, with no separate image file to host. You get the full data URI (data:image/png;base64,...), the plain Base64, a ready CSS background-image rule, an img tag and a Markdown image. It also works the other way: paste a data URI or Base64 text and download the picture. The type is read from the file itself, so PNG, JPEG, GIF, WebP, SVG and ICO are all recognised. Everything happens in your browser, nothing is uploaded. Base64 is about a third bigger than the file, so use it for small icons and logos, not for photos.
How to use it
- 1Drop a picture, or switch to Base64 to image and paste the text.
- 2Copy the data URI, the plain Base64, the CSS or the HTML you need.
- 3To go back, paste a data URI or Base64 and download the picture.
Common uses
- Embed a small logo or icon in an HTML email so it shows without a hosted image.
- Put an icon straight into a CSS file as a background-image.
- Keep a single HTML file self-contained, with its pictures inside.
- Store a small image inside a JSON file, a config or a database field.
- Turn a Base64 string from an API response or a log back into a picture to look at it.
- Check what a data URI in a stylesheet really contains.
Questions
Is my picture uploaded?
No. The picture is encoded in your browser and never leaves your device.
What is a data URI?
A data URI holds a file inside a web address: data:image/png;base64, followed by the picture as text. Browsers show it like a normal image.
Which pictures work?
PNG, JPEG, GIF, WebP, SVG and ICO, up to 10 MB. The type is detected from the file content.
Why is the Base64 bigger than my file?
Base64 writes 3 bytes as 4 characters, so the text is about a third bigger. That is why it suits small icons better than photos.
How do I turn Base64 back into an image?
Switch to Base64 to image, paste the data URI or the plain Base64 and download the picture. Line breaks and spaces are ignored.
Can I use the data URI in CSS?
Yes. Copy the CSS snippet, it is a ready background-image rule with the data URI inside quotes.
Which size should I keep under?
Keep inline pictures under a few kilobytes. Larger ones slow the page, because they cannot be cached on their own like a separate file.