Image to Base64 Converter
Convert any image file to a Base64 encoded data URL for embedding directly in CSS, HTML, or JavaScript code.
Runs in your browser. No data leaves your device.
Frequently Asked Questions
How does the Image to Base64 Converter work?
Your image is drawn onto an OffscreenCanvas and encoded to a PNG blob using convertToBlob(). The blob's ArrayBuffer is then converted to a Base64 string by mapping each byte through String.fromCharCode() and calling btoa(). The tool assembles a complete data URL with the MIME prefix and generates ready-to-paste HTML img tags and CSS background-image declarations.
Why would I convert an image to Base64?
Base64-encoded images can be embedded directly in HTML, CSS, or JavaScript without a separate file request. This is useful for small icons, email templates, and reducing HTTP requests on websites.
Does Base64 make the image larger?
Yes, approximately 33% larger than the original file. This is why Base64 embedding is best for small images (under 10KB). For larger images, serving them as separate files is more efficient.
What image formats can I convert?
JPG, PNG, GIF, WebP, SVG, BMP, and ICO files. The tool outputs a complete data URL string ready to paste into your code.