T

Image to Base64

Online Image to Base64 Converter

or drag and drop here

Image to Base64 Description

Convert images to Base64 strings or Data URIs. Ideal for embedding small images directly into HTML or CSS.

How to use

  1. Upload an image file or drag and drop it into the tool.
  2. Select the output format (Data URI, CSS background-image, or raw Base64).
  3. Copy the generated string.

Common Scenarios

  • Embedding small icons or logos directly into HTML/CSS to reduce HTTP requests.
  • Sending image data via JSON APIs.
  • Storing small images in databases as strings.

Data Structure

The result is a long ASCII string. For Data URIs, it includes a prefix like data:image/png;base64,....

Principles

The tool reads the binary data of the image file and uses the Base64 encoding algorithm to represent it using only 64 printable ASCII characters.