Encoding 🔒 Runs in your browser — no data sent to servers

Image to Base64 Converter

Turn an image into a Base64 string or a ready-to-paste data URI, without uploading it anywhere.

Input
Output

Convert an Image to Base64 Online

Embedding an image as Base64 lets it travel inside text: an HTML email, a CSS file, a JSON payload or a single self-contained HTML page. The browser reads the image straight from the string, so there is no extra file to host and no extra network request.

This page opens the Base64 Encoder & Decoder on its File tab with the data URI prefix switched on. Encoding happens entirely in your browser.

Where to paste the result

PlaceExample
HTML image<img src="data:image/png;base64,iVBORw0…" alt="Logo">
CSS backgroundbackground-image: url("data:image/svg+xml;base64,PHN2Zy…");
JSON field{"avatar": "iVBORw0KGgo…"} (usually without the prefix)
Markdown![icon](data:image/png;base64,iVBORw0…) where the renderer allows it

When inlining is a good idea

  • Small icons and logos of a few kilobytes, where an extra request costs more than the size increase.
  • HTML emails, where external images are often blocked by default (support for data URIs varies by email client, so test first).
  • Self-contained files such as exported reports or offline demos.
  • APIs that accept images only as Base64 in JSON.

When it is not

Large photos grow by a third and can no longer be cached separately from the page or stylesheet that contains them, so every page view downloads them again. For anything above roughly 10 to 20 KB on a website, a normal image file, ideally converted with PNG to WebP or JPG to WebP, is the faster choice.

SVG: consider not using Base64

SVG is already text. In CSS you can often embed it URL-encoded instead of Base64, which is smaller, for example url("data:image/svg+xml,%3Csvg …%3E"). The URL Encoder handles that encoding.

Going back from Base64 to an image

To recover the picture from a string, paste it into Base64 Decode: images are previewed and can be downloaded with the correct extension.

Guides