Skip to content

Image to Base64

Embed small images directly in code. Choose PNG, JPG, SVG, WebP, GIF or ICO files and copy them as a data URI, a CSS background, an HTML image tag or Markdown.

Processed in your browser · never uploaded

  1. 1Add input
  2. 2Review
  3. 3Download

How to use the Image to Base64

  1. Choose one or more images, or try the example.
  2. Choose the output: data URI, CSS, HTML or Markdown.
  3. Copy the code for each image, or download all of it as a text file.

Supported files and limits

  • SVG files are written as escaped text by default, which is smaller than Base64 and works in all current browsers.
  • The HTML tag includes the image width and height, so the page does not jump while it loads.
  • Base64 is about a third larger than the file. Use it for small images such as icons.
  • Up to 20 images of 5 MB each.

Common questions

When should I inline an image as Base64?
For small images, such as icons under 10 KB, it saves a request. Larger images are better as normal files, because they can be cached and do not delay the page or stylesheet they are in.
Do data URIs work in emails?
Not reliably. Gmail and Outlook often block them. Host email images as files instead.
Why is the SVG output not Base64?
SVG is text, so it can go into a data URI with only a few characters escaped. That is smaller and still readable. Untick the option to get Base64 instead.
Are my images uploaded?
No. They are converted in your browser and never sent to our server or anyone else.

Related tools