🖼️

Image to Base64

Drop any image to convert it to a Base64 string or a data URI. Choose the output format and copy it directly into HTML, CSS, or JSON. No file is uploaded —everything runs in your browser.

Image Tools Runs locally No data sent
Base64data URIembedimage
Image File
📤
Drop an image here or click to browse
JPEG, PNG, WebP, GIF, SVG, BMP, ICO —processed locally
preview

What is Image to Base64?

Image to Base64 converts an image file into a Base64-encoded string using the browser's built-in FileReader API. The output can be formatted as a raw Base64 string, a full data URI, a CSS background-image declaration, or an HTML img tag —whichever is needed for the target use case.

How to Use Image to Base64

  1. Drop an image file onto the drop zone, or click to browse.
  2. Choose an output format: Data URI, Raw Base64, CSS background-image, or HTML img tag.
  3. Copy the result to your clipboard with one click.
  4. Paste directly into HTML, CSS, JSON, or any other destination.
Understand Base64 Image Encoding ▾
Example
Input logo.png (2 KB)
Output data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA...
Common Use Cases
  • Embed a small logo in an HTML email
  • Inline a spinner or icon in a CSS file
  • Pass image data as a JSON string to an API
  • Create self-contained HTML files with embedded images
Why Use This Tool
  • Four output formats —data URI, raw Base64, CSS, and HTML.
  • Shows original size vs encoded size and the % increase.
  • Warns when the image is large enough to impact page performance.
  • No file upload —everything runs in your browser.
Frequently Asked Questions
What is a Base64 image?

Base64 is a way to encode binary data (like an image) as a plain-text ASCII string. A data URI is a Base64 string prefixed with the MIME type, formatted as data:image/png;base64,... —this can be placed directly in the src attribute of an img tag or in a CSS background-image to embed the image without a separate file request.

When should I use data URIs?

Data URIs are ideal for small icons, logos, or inlined images in HTML emails where external file references may be blocked. For large images they increase page weight and can hurt performance, so use them sparingly.

Is my image uploaded to a server?

No. The FileReader API encodes the image directly in your browser. Your image never leaves your device.

How much larger is a Base64 image?

Base64 encoding increases the data size by approximately 33% because every 3 bytes of binary data become 4 ASCII characters. A 100 KB image becomes roughly 133 KB as a Base64 string.