Skip to content
ToolsMastar

Convert an Image to Base64

Encode an image file as a Base64 string for embedding in JSON, APIs or source code.

Input:
JPG, PNG, WEBP, AVIF, GIF, SVG, BMP
Output:
TXT
Max size:
50 MB
Runs:
In your browser (no upload)

What the Image to Base64 does

Encode an image file as a Base64 text string that you can paste into JSON, CSS or HTML, with or without the data URI prefix.

Options

  • Include the data:image/…;base64, prefix.

Good to know

Base64 text is about 33% larger than the original file, so it is best for small images and icons.

How to use the Image to Base64

  1. 1

    Drag your JPG, PNG, WEBP, AVIF, GIF, SVG, BMP file into the upload area, or click it to browse your device.

  2. 2

    Adjust the options to suit your needs — the defaults work well for most files.

  3. 3

    Click “Run Image to Base64” to start processing.

  4. 4

    Preview the result, then download it. Batch results can be downloaded together as a ZIP.

Supported formats

  • JPG (JPEG) is a lossy format ideal for photographs. It has no transparency and is supported everywhere. More about the JPEG / JPG format.
  • PNG is a lossless format that supports full transparency. Best for screenshots, logos and graphics with sharp edges. More about the PNG format.
  • WebP is a modern format from Google supporting lossy and lossless compression plus transparency, typically 25–35% smaller than JPG. More about the WebP format.
  • AVIF is a next-generation format based on the AV1 codec, offering excellent compression and HDR support. More about the AVIF format.
  • GIF supports simple animation and up to 256 colors per frame. It is universally supported but produces large files. More about the GIF format.
  • SVG is an XML-based vector format that scales to any size without losing sharpness. More about the SVG format.
  • BMP is an uncompressed Windows bitmap format. Files are large and rarely needed on the web.

Frequently asked questions