Image to Base64 Converter

Convert JPG, PNG, WebP, GIF, SVG, BMP or AVIF to Base64 with the correct data URI prefix.

Your files are processed on your device and are never uploaded.

Convert an image to a Base64 string and a ready-to-use data URI, so you can put the picture straight into HTML, CSS, JSON, an email template or an API request – no separate image file and no extra HTTP request. JPG, PNG, WebP, GIF, SVG, BMP, AVIF and ICO all work, and the correct MIME prefix is added for you.

Image to Base64 Converter with ShrinkBee

How to Convert an Image to Base64

  1. Choose, drop or paste an image. A preview, the file size and the encoded size appear.
  2. Copy the snippet you need: the plain Base64 string, the full data URI, an HTML <img> tag or a CSS background-image rule.
  3. Optional: tick Wrap at 76 characters for MIME email bodies.

What the Output Looks Like

A data URI starts with the image type, followed by the encoded bytes:

data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA…

Paste that whole string where you would normally put an image URL – in <img src="…">, in CSS url('…'), or as a JSON value.

When Base64 Images Make Sense

  • Small icons and logos (under ~10 KB) in CSS or HTML, saving a network request each.
  • HTML emails where linked images are blocked by default.
  • Single-file pages and reports that must work offline.
  • APIs and JSON that accept images as text fields, such as many OCR and AI vision APIs.

When to Avoid It

Base64 makes data about 33% larger than the original file, and the browser cannot cache an inline image separately from the page. For big photos on a website, a normal image file is faster. Make the image small first with Image Compressor or Resize Image in Pixels if you must inline it.

Byte-for-Byte Encoding

The file is encoded exactly as it is – nothing is resized or re-compressed – so decoding the string with Base64 to Image gives back the identical file. For vector logos, SVG to Base64 also offers a shorter URL-encoded version.

Private

Encoding runs entirely in your browser. Your images are never uploaded, so it is safe for internal screenshots and unreleased designs.

Base64 to Image SVG to Base64 File to Base64 PDF to Base64 Validator & Repair

Frequently Asked Questions

How do I convert an image to Base64?
Choose, drop or paste the image. The Base64 string, data URI, HTML tag and CSS rule appear at once – copy the one you need.
How do I use a Base64 image in HTML?
Put the data URI in the src attribute: <img src="data:image/png;base64,…">. The tool gives you the complete tag.
Why is the Base64 string bigger than my image?
Base64 turns every 3 bytes into 4 text characters, so the result is about 33% larger.
Does it work for JPG and PNG?
Yes, plus WebP, GIF, SVG, BMP, AVIF and ICO. The correct MIME type is detected automatically.
Is the image changed or compressed?
No. It is encoded byte for byte, so decoding it gives back the identical file.
Is Image to Base64 free to use?
Yes. Image to Base64 is completely free, with no sign-up, no watermark and no limit on how many times you use it.
Are my files uploaded to a server?
No. Your files are processed directly in your web browser on your own device. Nothing is uploaded or stored, and the file is gone from memory when you close the tab.

More Base64 Tools

Made With ♥ By ShrinkBee