Handitab

Image to Base64

Convert an image file to a Base64 data URI, raw Base64 string, HTML img tag, or CSS background rule that you can paste straight into code.

About Image to Base64

Base64 encoding turns the binary bytes of an image into plain text that can be embedded in HTML, CSS, or JSON. This tool decodes your image, re-encodes it as PNG, JPG, or WebP through a canvas, then Base64-encodes that file. The output is therefore not a byte-for-byte copy of the original, and an SVG is rasterized instead of kept as vector markup. Base64 text is about 33 percent larger than the file.

Also known as: Image to Base64 Converter, SVG to Base64 Converter.

How to use Image to Base64

  1. Choose an image, or drag it onto the upload area. The file is read by your browser and is not uploaded.
  2. Set "Format", "JPG/WebP quality" and "Output". The preview updates as you change them.
  3. Check the preview, then press "Download result" to save the file.

Questions about Image to Base64

Is the Base64 output identical to my original file?

No. The image is redrawn and re-encoded in the format you select before it is turned into Base64, so the bytes differ from the source and metadata is gone. The pixels match when you choose PNG.

Should I embed images as Base64 in my web page?

It suits small icons and inline images in emails or single-file pages, because it saves a request. For larger images it is a poor trade: the text is about a third bigger and cannot be cached separately from the page.

Runs in your browser. Page last updated .

More encoding and data tools

All 28 encoding and data tools