Image ↔ Base64

Encode images to Base64 data URIs or decode Base64 back to an image.

No upload

Loading tool…

Processing happens on your device using your browser's CPU/GPU. Results are kept only in this tab's memory and are wiped when you click “Clear” or close the page.

About Image ↔ Base64

A Base64 data URI lets you paste an image straight into CSS, HTML, an e-mail template or a JSON payload, so it needs no separate file and no extra request. This tool encodes any image to a data URI with ready-made copy buttons, and it also decodes a Base64 string back into a downloadable picture. Both directions run entirely in your browser.

How to use Image ↔ Base64

  1. Choose Image to Base64 and pick a file, or switch to Base64 to Image to go the other way.
  2. When encoding, the data URI appears in the box along with its length in characters and bytes.
  3. Use Copy as CSS or Copy as img for a ready snippet, or Copy and Download for the raw string.
  4. When decoding, paste the data URI or bare Base64 and click Decode to preview and save the image.

What people use it for

  • Inlining a small icon or logo in CSS so the page makes one request fewer.
  • Embedding a signature or header image inside an HTML e-mail template.
  • Passing an image through an API or config file that can only carry text.
  • Recovering a picture from a Base64 string you found in code or a log file.

Good to know

Base64 makes data about 33% larger, so it suits icons and small logos rather than photographs. Keep inlined images under roughly 10 KB; beyond that a normal file loads faster and caches better. Decoding accepts a full data:image URI or a bare Base64 string, with PNG, JPEG, GIF and WEBP detected from the signature.

Frequently asked questions

Why is the Base64 string bigger than the file?
Base64 encodes every three bytes as four text characters, which adds about 33%. That overhead is the price of carrying binary data inside plain text.
When should I not inline an image?
For anything above about 10 KB, and for images used across many pages. Inlined data cannot be cached on its own, so it is downloaded again with every single page.
Does it work without the data: prefix?
Yes. If you paste raw Base64, the type is guessed from the first few characters, and PNG, JPEG, GIF or WEBP is assumed accordingly before decoding.