Image to Base64 Converter — Convert Images to Data URIs Online

Drag and drop any image to get a Base64-encoded data URI, ready to paste directly into your HTML or CSS. Supports PNG, JPG, GIF, SVG, and WebP.

When to Use Image Data URIs

Data URIs let you embed images directly in your code, eliminating HTTP requests. They're ideal for small icons and favicons in CSS, inline images in HTML emails (which can't load external resources reliably), sprites in single-page apps, embedding images in JSON API responses, and reducing HTTP requests for critical above-the-fold images.

Size Considerations

Base64 encoding increases file size by approximately 33%. A 3 KB icon becomes ~4 KB as Base64, which is fine. But a 100 KB photo becomes ~133 KB and can't be cached separately by the browser. The general rule: use data URIs for images under 10 KB. For larger images, serve them as regular files with proper cache headers.

Ready-to-Use Output Formats

Raw Base64: The encoded string without any prefix — for APIs and custom implementations
Data URI: The complete data:image/...;base64,... string ready for HTML src or CSS url()
HTML <img> tag: A complete <img> element you can paste directly into your HTML
CSS background-image: A background-image rule ready for your stylesheet

Drop your image below — the converter is ready.

📁

Drop a file here or click to upload

Images, PDFs, text, fonts — any file up to 10 MB