Image to Base64

Encode an image as a Base64 data URI for CSS, HTML or JSON.

  • Free
  • No sign-up
  • Runs in your browser

Processed in your browser. Your files never leave your device.

How to use Image to Base64

  1. Choose an imageSelect or drop a JPG, PNG, WebP, GIF, BMP or AVIF file, or paste one from the clipboard.
  2. Encode itPress Encode image. The file is encoded exactly as it is, without resizing or recompressing it.
  3. Copy the code you needCopy the plain data URI, a ready-made HTML img tag or a CSS background-image rule, each with its own Copy button.

Common uses

  • Embed a small icon directly in a stylesheet
  • Put an image inside a single HTML file or email template
  • Store a picture as text in JSON

Frequently asked questions

How do I use Image to Base64?

1. Choose an image: Select or drop a JPG, PNG, WebP, GIF, BMP or AVIF file, or paste one from the clipboard. 2. Encode it: Press Encode image. The file is encoded exactly as it is, without resizing or recompressing it. 3. Copy the code you need: Copy the plain data URI, a ready-made HTML img tag or a CSS background-image rule, each with its own Copy button.

Is the output a data URI or raw Base64?

It is a full data URI that starts with data:image/…;base64, followed by the encoded data. For the raw Base64 string, delete everything up to and including the comma.

Why is the Base64 text larger than the file?

Base64 uses four characters for every three bytes, so the result is about a third larger than the original. The character count is shown above the output.

Which images work best?

Small icons, logos and simple graphics. Large photos produce very long strings that make your HTML or CSS heavier.

Is my image uploaded?

No. It is read and encoded in your browser and never sent to a server.