Image to Base64

Drop an image to convert it to Base64. Build data URIs, CSS backgrounds, and HTML img tags — files never leave your browser.

Runs 100% client-side
Copy output
On this page4 sections

Drop an image here, or click to browse

PNG, JPG, GIF, SVG, WebP

HOW TO USE

  1. 01Drop an image into the zone, or click to browse.
  2. 02Pick the output format — Data URI for use anywhere, Raw Base64 for fixtures, CSS for stylesheets, or an HTML img tag.
  3. 03Click Copy — the file never leaves your browser.

WHEN TO USE

Use this when you need to embed an image directly in HTML, CSS, or JSON without serving it from a separate file — common for small icons, test avatars, loading placeholders, and email-safe images. Also use it to create the expected-value side of an image assertion: encode a reference image to Base64 and compare against what an API or canvas export returns. The file never leaves your browser, which is useful when working with screenshots or sensitive test assets.

WHAT BUGS THIS FINDS

  • Missing MIME type prefix in data URI

    An img src or CSS background-image receiving raw Base64 without the data:image/png;base64, prefix renders as a broken image — the Data URI format includes the correct prefix.

  • Image encoding pipeline round-trip error

    An API that accepts Base64-encoded images returns a corrupt decode — encode a known-good test image here, send the result to the API, then decode the response to confirm lossless round-trip.

  • Oversized inline image causing payload rejection

    An API rejects a request because the Base64 image field exceeds the payload size limit — encoding here shows the exact character count before you attempt the upload.

  • Wrong image format assumed by pipeline

    A processing pipeline assumes PNG but receives JPEG — the Data URI output's MIME type shows the format the browser detected, surfacing the mismatch before it hits the server.

QA USE CASES

01

Test avatar fixture creation

Encode a small placeholder image to Data URI and embed it in a JSON fixture for a user profile test — no image hosting needed and the fixture is fully self-contained.

02

API image upload testing

Encode a reference image to Raw Base64, paste it into the test request body for an image-upload endpoint, and confirm the API accepts and stores it correctly.

03

Email template image embedding

Embed a small logo as a Data URI in an HTML email template test fixture so the image renders in email client tests without requiring an external CDN.