About the Image to Base64
Small icons are sometimes embedded straight into HTML or CSS as Base64 to save a request. This tool encodes images and gives ready-to-paste <img> and CSS snippets, and also decodes Base64 back to a file.
Base64 turns binary data such as an image into plain text. A data URL like data:image/png;base64,… can be placed directly in HTML, CSS, JSON or an email template, so the image travels with the code and needs no separate file.
The tool gives you four ready formats: the full data URL, raw Base64, an <img> tag and a CSS background rule. It also works the other way, turning a Base64 string back into an image file you can download.
How to use the Image to Base64
- 1Choose an image (or switch to Base64 → Image).
- 2Pick the output: data URL, raw Base64, <img> tag or CSS.
- 3Copy the result or download the decoded image.
Key features
- Image to data URL, raw Base64, <img> tag or CSS snippet.
- Base64 to image decoding with download.
- Shows the length of the encoded string.
Practical uses
- Embedding a small logo in an HTML email signature or template.
- Inlining tiny icons in CSS to avoid extra requests.
- Recovering an image that was stored as Base64 in a database or JSON file.
Example
Your email signature has a 3 KB company logo that some mail apps show as an attachment. Encode it here, choose the <img> tag output and paste it into the signature’s HTML. The logo is now part of the HTML itself. Test by sending yourself an email, since some clients still block inline images.
Tips and common mistakes
- Use it for small images (a few KB); large Base64 strings bloat your HTML and CSS.
- Some email clients block data-URL images; test before sending a campaign.
- Compress the image first to keep the string short.
Limitations
- Base64 is about 33% bigger than the original file.
Privacy
Encoding and decoding happen in your browser; neither the image nor the text is uploaded.
Frequently asked questions
Does Base64 make files bigger?
Yes, about 33% larger than the original file, so it is best for small images.
What is a data URL?
A string like data:image/png;base64,… that browsers can use in place of an image URL.
Is there a size limit?
Large images work but create very long strings that can slow down code editors.
Is Base64 encryption?
No. It is an encoding anyone can reverse. Do not use it to hide information.
Which images should not be inlined?
Photos and anything over about 10 KB are better as normal files that browsers can cache.
How do I decode Base64 from a JSON API?
Switch to Base64 → Image, paste the string (with or without the data: prefix) and download the image.