Skip to content
ToolsFort home

Image to Base64 Converter

Convert an image to a Base64 data URI, plain Base64, a CSS background or an HTML img tag, ready to copy.

Updated

This image to Base64 converter encodes a picture as text, so it can be embedded directly in HTML, CSS, JSON or an email template instead of being loaded as a separate file.

How to use the Image to Base64 Converter

  1. 1 Drop an image on the box or click to choose it.
  2. 2 Pick the output: data URI, Base64 only, CSS or HTML.
  3. 3 Click Copy and paste it into your code.

Worked examples

Small icon in CSS

Input: icon.png, 1 KB

Result: background-image: url("data:image/png;base64,iVBOR…")

Saves one request for a tiny image.

Image in JSON

Input: avatar.jpg

Result: A Base64 string for an API field

What is Base64 image encoding?

Base64 turns binary data, such as an image, into plain text made of letters, digits, plus and slash. A data URI wraps that text with the image type, for example data:image/png;base64,iVBORw0…, so browsers can display it anywhere a normal image URL works: in an <img> tag, a CSS background-image, an SVG or an email.

When to use the image to Base64 converter

  • Small icons and logos in CSS or HTML, to save a separate download.
  • Email templates, where linked images may be blocked.
  • APIs and JSON, which carry only text.
  • Single-file HTML pages that must work offline.

When not to use Base64

Base64 text is about 33% larger than the original file, and an embedded image cannot be cached separately by the browser. For photos and anything larger than a few kilobytes, a normal image file loads faster. The converter shows the size before and after so you can judge.

Output formats

  • Data URI: the complete data: string, for src and url().
  • Base64 only: just the encoded text, for APIs that store the type separately.
  • CSS: a ready background-image declaration.
  • HTML: a ready <img> tag (add your own alt text).

Private by design

Your images are processed by your own browser and never uploaded to a server, so they stay on your device. There is no watermark, no sign-up and no limit on how many images you convert.

Frequently asked questions

Why is the Base64 text bigger than the image?

Base64 uses 4 characters for every 3 bytes, so it is about 33% larger.

Which image formats work?

Any format your browser can open, including PNG, JPG, GIF, WebP, SVG and ICO.

Should I embed large photos as Base64?

Usually not: they become a third larger and cannot be cached. Use Base64 for small icons and logos.

Is my image uploaded?

No. It is encoded in your browser.

Esc