Image to Base64
Turn a picture into Base64 text you can paste into HTML or CSS, or turn Base64 text back into a picture. Your pictures are processed in your browser and never uploaded.
Using a Base64 picture
- In HTML: <img src="data:image/png;base64,…" alt="…">
- In CSS: background-image: url("data:image/png;base64,…");
- In emails and single-file pages, where a separate picture file may be blocked or lost.
The trade-offs
- The text is about 33% bigger than the picture file.
- The browser cannot cache a Base64 picture separately, so it is downloaded again with every page.
- It is a good fit for icons and logos under about 10 KB, and a poor fit for large photos.
- Compress or resize the picture first to keep the text short.
Your pictures stay private
This tool works entirely inside your web browser. Your pictures are read by your own device, changed there and saved from there. They are not uploaded to a server, so nothing is stored, shared or seen by anyone else, and the page keeps working if your connection drops after it has loaded.
How to use the Image to Base64 tool
- Choose Picture to Base64, then drop your picture on the box or click it to choose one.
- Pick Data URI, Base64 only, HTML or CSS, and press the copy button.
- To go the other way, choose Base64 to picture, paste the text and download the picture.
Frequently asked questions
What is a Base64 data URI?
It is a picture written as text, in the form data:image/png;base64,… You can use it as the src of an image or in CSS, so the picture is part of the page and needs no separate file.
When should I use Base64 pictures?
For small icons and logos in emails, single-file HTML pages and CSS. Avoid it for large photos: Base64 makes the data about a third bigger and the browser cannot cache it separately.
How do I convert Base64 back to an image?
Choose Base64 to picture, paste the text with or without the data: prefix, check the preview, and press Download picture.
Why is the Base64 text longer than the file?
Base64 uses 4 characters for every 3 bytes, so the text is about 33% larger than the original picture.
Is my picture uploaded?
No. The conversion happens in your browser, so your picture stays on your device.