Image to Base64

Convert images to Base64 data URLs for HTML, CSS and Markdown

Encode an image as a Base64 data URL, raw Base64, an HTML <img> tag, a CSS background or Markdown, ready to paste into code - with the size overhead shown.
Try an example:

Click, drag & drop, or paste (Ctrl/⌘+V) an image

PNG, JPG, WEBP, GIF · up to 25 MB

Processed image will appear here...

About Image to Base64

How it works

  1. The image file's bytes are read by your browser.
  2. They are encoded as Base64 text - every 3 bytes become 4 characters.
  3. The text is wrapped in the format you choose: a data URL (data:image/png;base64,…), an HTML tag, CSS, or Markdown.

What you need

  • Any image file. Small images (icons, logos under ~10 KB) work best.

Tips

  • Inlining small icons saves an extra network request.
  • Base64 is about 33% larger than the file, and inlined images cannot be cached separately - for anything over ~10-20 KB, a normal image file is faster.

Limitations

  • The image is encoded exactly as uploaded - resize or compress it first to keep the output short.

Runs in your browser. Your image never leaves your device - it is processed by your browser and nothing is uploaded.

Frequently asked questions

When should I inline images as Base64?+

For tiny images such as icons in CSS, email signatures, or single-file HTML documents. For normal photos use regular image files so browsers can cache them.