Skip to main content
Runs in your browser

Image to Base64

Encode any image as a base64 data URL, ready to paste into HTML, CSS, JSON, or email. Runs in your browser.

Drop an image or click to browse

JPG · PNG · WebP · GIF · BMP · TIFF — max 25 MB

When to base64-encode an image

A data URL bakes an image directly into a text document — HTML, CSS, JSON, email — so it travels with the document and needs no separate HTTP request. It is useful for small icons, one-off emails, Jupyter notebooks, unit-test fixtures, and Markdown that must work offline.

The trade-off: base64 inflates file size by roughly 33% (four ASCII characters per three binary bytes), and most browsers cannot cache a data URL independently — the image is re-downloaded every time the parent document is. For anything above a few KB or shared across pages, a regular <img src="/logo.png"> reference is almost always faster.

Good candidates

  • SVG and small PNG icons (under ~4 KB)
  • Email signatures and HTML newsletters (no external hosting)
  • Placeholder images during tests or mockups
  • Self-contained HTML demos and PDF exports

Avoid for

  • Hero images or photographs larger than ~10 KB
  • Assets used on many pages (you lose browser caching benefits)
  • Images that change often (no cache invalidation)