Skip to content

Image to Base64 Converter — Data URI, CSS, HTML

Encode an image as a Base64 data URI and copy it as raw Base64, CSS background, HTML img tag or Markdown. Detects PNG, JPG, GIF, WebP, SVG and more.

Convert in your browser · No sign-up

One image up to 15 MB · PNG, JPG, GIF, WebP, AVIF, SVG, BMP or ICO

How to use

  1. Choose an image or drop it into the box.
  2. Pick the output: data URI, Base64 only, CSS, HTML or Markdown.
  3. Copy the text or download it as a .txt file.

Example

logo.png (1.2 KB) → data:image/png;base64,iVBORw0KGgo… (about 1.6 KB of text)

Details and limitations

Base64 text is about 33% larger than the file. Inline small icons and logos; link to larger images instead to keep pages fast.

The image type is detected from the file contents, not its name: PNG, JPG, GIF, WebP, AVIF, SVG, BMP and ICO. Encoding happens in your browser.

FAQ

When should I use a Base64 data URI?

For tiny images in CSS, HTML emails or single-file pages, where saving a request matters more than size. Data URIs are not cached separately from the page.

Is the image uploaded?

No. The file is read and encoded on your device.

Format references

Tool page updated: