Image to Base64

Choose or drop an image and get its Base64 as plain text, Data URI, CSS, HTML or JSON. Everything happens in your browser.

Image file

Nothing is stored or sent to any server.

The Image to Base64 tool turns an image file into a text string that you can embed directly in your code. Pick a file or drop it on the upload area and you will see a preview together with its name, type, dimensions and size. The result comes in five formats: plain text, Data URI, a CSS rule with background-image, an HTML img tag and a JSON object. Switching format is instant and does not read the file again. It accepts PNG, JPEG, GIF, WebP, BMP, ICO, AVIF and SVG up to 10 MB. Everything happens in your browser and the image is never uploaded to a server.

How to use it

  1. Pick an image with the selector or drop it on the upload area.
  2. Check the preview and the file data.
  3. Choose the output format: plain text, Data URI, CSS, HTML or JSON.
  4. Click Copy to put the result on your clipboard.

Frequently asked questions

Which image formats does it accept?
PNG, JPEG, GIF, WebP, BMP, ICO, AVIF and SVG, up to 10 MB per file. The type is detected from the content, not from the file name extension.
Is my image uploaded to a server?
No. The conversion runs in your browser using the browser's own APIs, and nothing is stored or sent.
When is embedding an image as Base64 a good idea?
With small images such as icons it saves an extra request. Base64 is a third larger than the original file, so it does not pay off with big images.
How can I check the result?
Paste the Data URI into the Base64 image viewer and you will see the same image you picked.

Related tools