Image to Base64 converter

This image to Base64 converter turns a PNG, JPEG, WebP, GIF, AVIF or BMP into a data URL, plain Base64 or a ready CSS, HTML or Markdown snippet. It can shrink the picture first.

  • Free
  • No sign-up
  • Image stays on your device
  • Up to 25 MB

Drop an image, paste it, or choose a file
PNG, JPEG, WebP, GIF, AVIF or BMP, up to 25 MB. Your image never leaves your device.

Add an image to see its Base64 here.

How to use it

  1. 1Drop, paste or choose an image.
  2. 2Pick the output: data URL, Base64 only, CSS, HTML or Markdown. Choose a width or WebP first if you want it smaller.
  3. 3Copy the result or download it as a text file.

When to use a Base64 image

A Base64 image is the picture’s file written as text. As a data URL it works where an image link does: an img tag, a CSS background or a Markdown file, if the app showing it allows data URLs. Nothing has to be hosted.

The cost is size: Base64 is about a third larger than the file, and a browser can’t cache an inline image apart from the page that holds it. That suits icons, logos and small backgrounds; for photos, a normal image file is usually the better choice.

To keep the text short, choose a width or WebP. The page redraws the picture on a canvas in your browser and encodes the result; animation and metadata such as camera details aren’t kept, JPEG and WebP are saved at 85% quality, and GIF, AVIF and BMP come out as PNG. With Original and Original size, your file is encoded untouched.

Questions

Related tools