Convert Image to Base64 Online

Base64-encoded images are embedded directly in HTML, CSS, and JSON without requiring a separate image file request. This technique is used in HTML emails where external images may be blocked, in CSS for small background images and icons, in web applications that need to transmit image data through JSON APIs, and in offline-capable applications that bundle assets into a single file. This tool converts any image file to a Base64 data URI, producing a string like data:image/png;base64,... that can be used directly as a src attribute in an img tag or as a url() value in CSS. Supported formats include PNG, JPEG, GIF, WebP, and SVG. The entire conversion happens in your browser — your image is never uploaded to any server.

Drop an image here or click to browse

Supported: PNG, JPEG, GIF, WebP, SVG

FAQ

What is a Base64 data URI?
A data URI embeds file contents directly in a URL using the format data:[mediatype];base64,[data]. For images, this means the entire image is encoded as Base64 text and used as the image source without a separate HTTP request.
When should I use Base64 images vs external image files?
Base64 is best for small images (icons, thumbnails) where the HTTP request overhead is significant relative to the image size. For larger images, external files with proper caching are more efficient because Base64 increases size by ~33%.
Can I use the output directly in an img tag?
Yes. Copy the full data URI (starting with data:image/...) and use it as the src attribute value of an img element. All modern browsers support this.

Related Conversions