Skip to content
OurImg logo
Image utilities

Convert Image to Base64 Online

Embed a small image directly in your HTML, CSS or JSON by converting it to Base64. Drop an image and copy it as a full data URI, a raw Base64 string, a ready-made CSS background rule or an HTML img tag.

  • Never uploaded
  • Instant, no sign-up
  • Works offline
Loading tool…

About this tool

Base64 text is about a third larger than the original file, so it is best for small icons and inline graphics. The tool shows you the size difference before you copy.

How it works

  1. 1

    Drop an image (up to 10 MB).

  2. 2

    Choose the output style: data URI, Base64, CSS or HTML.

  3. 3

    Copy it or download it as a .txt file.

Features

  • Four output stylesData URI, raw Base64, CSS background-image and an HTML img tag.
  • Size comparisonSee how much larger the encoded text is than your file.
  • Copy or downloadOne-tap copy, or save the text file.
  • Also decodesSwitch to the other tab to turn Base64 back into an image.

Supported formats

Input: PNG, JPG, WebP, GIF, SVG, AVIF, BMP (up to 10 MB). Output: text.

Frequently asked questions

What is a data URI?

A URL that contains the file itself, like data:image/png;base64,…, so no separate file request is needed.

When should I not use Base64?

For large photos. Encoded images are bigger, can't be cached separately and slow down pages. Use it for small icons.

Does the tool change my image?

No. Your file's exact bytes are encoded.

Are my images uploaded to a server?

No. Files are decoded, processed and re-encoded by your browser using the canvas API and Web Workers. Nothing is sent to any server, and there is no account or storage. Closing the tab discards everything.

Need more than one tool?

The full editor combines cropping, adjustments, filters, text, shapes and layers in one place.

Open the editor