Image to Base64
Choose a small image and get its Base64 text, a data URL, an HTML image tag and a CSS background to paste straight into code.
Free, no sign-up. Your image is processed in your browser and never uploaded.
Your image
Choose an image to begin.
How to
Encode an image in three steps
Choose a small image
Pick a PNG, JPG, WebP, GIF or BMP file. Files up to 3 MB are accepted, because Base64 makes the data a third bigger.
Copy what you need
Take the full data URL, the Base64 text alone, an HTML img tag or a CSS background-image line.
Paste into your code
Use it in an email template, a stylesheet or a single-file page. No separate image request is needed.
When Base64 images make sense
- Use them for tiny images such as icons, because each one saves a separate request.
- Avoid them for large photos: the text is about 33% bigger than the file and cannot be cached on its own.
- Keep the original file as well. You cannot edit an image easily once it is text.
- In CSS, put data URLs in a file the browser caches, rather than inline in every page.
FAQ
Image to Base64 questions
What is a Base64 image?
The image file written as plain text using 64 safe characters. With a data: prefix it can be used directly as an image address in HTML or CSS.
Is my image uploaded to be encoded?
Nothing is uploaded: the page makes no network request with your image. The file is read and encoded in your browser.
How much bigger is the Base64 text?
About one third bigger than the file. The tool shows the exact increase for your image.
Why is there a size limit?
Very large images turn into millions of characters that are slow to copy and paste. The limit is 3 MB of image data. For large images, link to a file instead.
Can I convert SVG files?
Not here. SVG images can contain scripts, so only PNG, JPG, WebP, GIF and BMP files are accepted.
How do I turn the Base64 back into an image?
Use the Base64 to Image tool: paste the text and download the picture.