Convert any image to a Base64 data URI right in your browser — no upload, no server, completely private.

🖼

Drag & drop an image here, or click to select a file

Supports PNG, JPG, GIF, SVG, WebP  ·  Max recommended: 2 MB
Preview

Type
Original size
Base64 size
Size increase
Base64 String (no prefix)
<div class="i2b-output-block">
  <div class="i2b-output-header">
    <span class="i2b-output-label">Data URI</span>
    <button class="i2b-copy-btn" data-target="i2b-out-uri">Copy</button>
  </div>
  <textarea id="i2b-out-uri" class="i2b-output-textarea" readonly spellcheck="false"></textarea>
</div>

<div class="i2b-output-block">
  <div class="i2b-output-header">
    <span class="i2b-output-label">CSS background-image</span>
    <button class="i2b-copy-btn" data-target="i2b-out-css">Copy</button>
  </div>
  <textarea id="i2b-out-css" class="i2b-output-textarea" readonly spellcheck="false"></textarea>
</div>

<div class="i2b-output-block">
  <div class="i2b-output-header">
    <span class="i2b-output-label">HTML &lt;img&gt; tag</span>
    <button class="i2b-copy-btn" data-target="i2b-out-html">Copy</button>
  </div>
  <textarea id="i2b-out-html" class="i2b-output-textarea" readonly spellcheck="false"></textarea>
</div>


How to use

  1. Drag and drop an image onto the zone above, or click to open the file picker.
  2. The tool reads the file locally using the FileReader API — nothing is sent to any server.
  3. Copy the output you need with the corresponding Copy button.

Output formats explained

FormatWhen to use
Base64 stringAPIs, databases, JSON payloads
Data URIDirect src attribute value
CSS background-imagePaste straight into a stylesheet
HTML <img> tagPaste straight into HTML

Why Base64-encode an image?

Embedding an image as a Base64 data URI lets you ship a self-contained HTML file or email template with no external requests. It is also useful for small icons in CSS, API payloads, and offline-capable web apps. The trade-off is a roughly 33% size increase and slightly slower initial parse — so keep embedded images small (under ~50 KB is a good rule of thumb).

Privacy

All conversion happens entirely in your browser. The image file never leaves your device.


Related tools: Base64 Encoder / Decoder · Image Resizer · Placeholder Image Generator