How to use the image to base64
- Add an image to encode it.
- Copy the result as a data URI, raw Base64, an
<img>tag or a CSS background rule. - To go the other way, paste Base64 into the lower box and press Decode to image.
What is Base64?
Base64 writes binary data using only 64 safe text characters. Encoding an image this way lets you embed it directly inside an HTML page, a stylesheet, an email or a JSON payload instead of linking to a separate file.
When embedding makes sense
- Small icons and logos in a single-file HTML page or email template.
- Images in JSON APIs or configuration files that can only hold text.
- Tiny CSS background images where saving a network request matters.
When it does not
Base64 makes data about 33% larger and embedded images cannot be cached separately by the browser. For anything over a few kilobytes, a normal image file is faster. Shrink the image first with the image compressor if you do embed it.