Image to Base64
Convert an image into a Base64 data URI to embed it directly in CSS or HTML — or paste Base64 to turn it back into a downloadable image. Everything runs in your browser.
Convert the other way
Need to go from Base64 back to an image? Use the dedicated page:
How to convert an image to Base64
- Drop in an image (or switch to Base64 → Image and paste Base64).
- Copy the Base64 data URI — toggle the data: prefix on or off.
- Paste it into your CSS or HTML, or decode it back to an image.
About image Base64 encoding
Encoding an image as Base64 turns it into a text string you can embed directly in a CSS background, an HTML img tag or a JSON payload — no separate file request needed. It’s handy for small icons, inline email images and data URIs, though it makes the data about 33% larger, so it’s best for small assets.
This converts both ways entirely in your browser: drop an image to get its data URI, or paste a data URI / Base64 string to preview and download the image. Nothing is uploaded, so private images stay on your device.
Size is not the only trade-off with inlining. A Base64 image is part of the document that contains it, so the browser cannot cache it separately, lazy-load it, or reuse it across pages the way it can a normal image file — change one byte of the page and the whole payload downloads again. Support has limits too: some email clients, Outlook most notably, refuse to display data URI images at all.
You will meet Base64 images in more places than hand-written CSS. Canvas drawing apps export via toDataURL, screenshot and signature widgets stash their output as data URIs, APIs return generated images as Base64 fields in JSON, and single-file HTML exports embed every graphic inline. When one of those strings lands in your lap — in a log, a database column or a page's source — decoding it back to a real file is usually the fastest way to see what it contains.
Frequently asked questions
What is a data URI?
A data URI embeds a file’s bytes directly in a URL as Base64, like data:image/png;base64,… — you can use it as an image source or CSS background with no separate file.
Why is the Base64 bigger than the file?
Base64 represents 3 bytes with 4 ASCII characters, so the text is about 33% larger than the original image. It’s best for small assets like icons.
Can I convert Base64 back to an image?
Yes. Switch to Base64 → Image, paste a data URI or raw Base64, and preview and download the decoded image.
Is my image uploaded?
No. Both directions run entirely in your browser, so your image or Base64 never leaves your device.
Does Base64 encoding change or compress my image?
No. Base64 is a re-spelling of the file's exact bytes using 64 safe ASCII characters — nothing is compressed, resized or re-encoded, and decoding returns a file identical to the original. Quality is untouched because the pixels are never touched. If you need a smaller string, compress or resize the image before encoding it — Base64 itself will never make a file smaller.