File Conversion

Active tool: Image → Base64 / Data URI

What It Does

Turns images into Base64 text (or a ready-to-paste data: URI, CSS, HTML, Markdown, or JSON snippet) so you can embed them directly in code — and turns a Base64/data-URI string back into a downloadable image. Everything happens in your browser; nothing is uploaded.

How to Use It

  1. Encode: drop images (up to 20), pick an output flavor (e.g. Data URI or CSS), then Copy the string or Download it as .txt.
  2. Decode: paste a Base64 body or a full data: URI, then Download the reconstructed image.
  3. Use Line wrap to format long strings for email/MIME, or leave it as a single line for code.

Options Explained

OptionDescription
ModeEncode (image → text) or Decode (text → image).
Output flavorRaw Base64, Data URI, CSS background-image, HTML <img>, Markdown, or JSON string.
Line wrapInsert newlines every 64/76 (or custom) columns, or keep one continuous line.
CSS selectorThe selector used when generating a CSS background-image rule.
Alt textThe alt attribute used when generating an HTML <img> tag.
Filename patternTemplate for the downloaded .txt file; must contain {name}.
Output format(Decode) the extension used when the pasted string has no or an ambiguous MIME type.
Tip: Inlining as a data URI saves an HTTP request for tiny icons, but it grows the bytes ~33% and can’t be cached separately — use it for small assets (< ~5 KB), and link larger images normally.

Drag & drop images here, or click to choose

PNG · JPEG · WebP · BMP · GIF · SVG (max 20, ≤ 10 MB each)

🔒 Processed entirely on your device — nothing uploaded.

Options

About Base64 & Data URIs

Base64 encodes binary data (like an image) using only 64 printable ASCII characters, so it can travel safely through text-only channels — HTML attributes, CSS, JSON, email (MIME), and URLs. A data URI wraps that text with a data:<mime>;base64, prefix so a browser can treat the string itself as if it were a file, letting you embed an image directly in your markup with no separate request.

The trade-off is size: because Base64 represents 3 bytes with 4 characters, the text is about 33% larger than the original file, and inlined assets can’t be cached or reused across pages the way a linked file can. That makes data URIs great for very small, frequently-inlined graphics (icons, tiny backgrounds, email images) and a poor fit for large photos. Because this tool only re-packages the exact file bytes as text (it never re-encodes the pixels), the image is preserved bit-for-bit — including animation and metadata — unlike the format converter, which re-renders through a canvas.