Image to Base64
Image to Base64 turns a picture into text you can paste straight into HTML, CSS or an email template.
What Image to Base64 does
Image to Base64 turns a picture into text you can paste straight into HTML, CSS or an email template. Small icons and logos embedded this way arrive with the page itself, without a separate image request.
Any image your device lets you pick is accepted, including PNG, JPG, GIF, WebP and SVG. The result is a ready data:image link by default, with the type taken from the file. Turn the data: link off when a system wants only the encoded part. Copy the text, or download it as a .txt file.
How to use Image to Base64
- Pick a picture
Choose an image from your phone or computer.
- Decide on the prefix
Leave the data: link on for img tags and CSS; switch it off for plain Base64.
- Use the result
Copy the text into your code, or save it as a .txt file.
Questions about Image to Base64
How do I use Base64 in an img tag?
Set the src attribute of the img tag to the full data: link copied from here. The browser shows the picture without loading a separate file.
How do I use it as a CSS background?
Write background-image: url(data:image/png;base64,...) and replace the dots with your own text.
Is Base64 good for large photos?
Usually not. The text is about a third bigger than the image and cannot be cached on its own, so keep it for small icons and logos.