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.
How to Convert an Image to Base64
- Choose, drop or paste an image. A preview, the file size and the encoded size appear.
- Copy the snippet you need: the plain Base64 string, the full data URI, an HTML
<img>tag or a CSSbackground-imagerule. - 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?
How do I use a Base64 image in HTML?
<img src="data:image/png;base64,…">. The tool gives you the complete tag.