Image to Base64

Convert images to Base64 encoded strings.

  • Runs in your browser
  • Up to 100 MB
  • No signup

Drop an image here or click to upload

Supports JPG, PNG, WebP, GIF, BMP, and SVG

Choose file

How to use Image to Base64

  1. Add an image

    Drop a JPG, PNG, WebP, GIF, BMP or SVG file. Encoding happens in your browser.

  2. Choose the output

    Copy the Base64 as a data URI, an HTML img tag or a CSS background declaration.

  3. Or decode

    Switch to Base64 to Image mode to paste a string and preview or download the picture.

How to convert an image to Base64

Base64 turns an image file into plain text that can be pasted straight into HTML, CSS, JSON or an email template. Image to Base64 produces a ready-to-use data URI with the correct MIME type, and can also decode a Base64 string back into an image.

When embedding images makes sense

Inlining small images such as icons, tiny logos and loading spinners saves a separate network request and keeps a single HTML file self-contained, which is handy for email templates, offline pages and quick prototypes.

When it does not

Base64 makes data about 33 percent larger than the original file, and embedded images cannot be cached separately by the browser. For photos and anything over a few kilobytes, linking to a normal image file is faster. Compress the image first if you do embed it.

Output formats

Copy the result in the form you need:

  • Data URI: data:image/png;base64,... for use anywhere a URL is accepted.
  • HTML img tag: ready to paste into a page or email template.
  • CSS background: a background-image declaration for stylesheets.

Private

Encoding and decoding happen in your browser, so the image is never uploaded. For Base64 work with text or other files, use the Base64 Encode/Decode tool.

Image to Base64: frequently asked questions