Image to Base64

Image to Base64, and back

Encode an image (or any file) as Base64 for HTML, CSS, JSON or an API call, or decode Base64 back into an image. Instant, and it all happens in your browser.

Image to Base64

Drop an image or any file here or browseProcessed in your browser: nothing is uploaded

Base64 to image

To get an image's Base64: drop it in the box above and copy the format you need. The data URI (data:image/png;base64,…) works directly in <img src> and CSS url().

When Base64 makes sense, and when a link is better

Use Base64 forUse a link for
Tiny icons and logos inside HTML, CSS or emailsPhotos and anything over about 100 KB
API requests that expect Base64 image dataSharing an image with people or an AI chat
Test data and single-file HTML pagesImages that should be cached by the browser

Pasting a long Base64 string into an AI chat wastes most of its context window and usually works worse than giving it the image itself. Upload the picture or turn it into a link instead.

Making it smaller first helps too: compress the image before encoding.

We tested it

Our 25.4 KB logo (26,022 bytes) became 34,696 Base64 characters, plus the 22-character data:image/png;base64, prefix. That's exactly 4 characters for every 3 bytes: 33% bigger. On a web page, that extra third is downloaded with the HTML every time instead of being cached as a separate file, so Base64 pays off for icons of a few KB, not for photos.

Frequently asked questions

How do I convert an image to Base64?

Drop the image above. You get its Base64 text straight away, as a data URI, plain Base64, an HTML img tag, a CSS background or Markdown. Pick one and click Copy.

How do I turn Base64 back into an image?

Paste the Base64 text or data URI into the "Base64 to image" box and click Decode. You'll see the image and can download it.

Is anything uploaded?

No. Encoding and decoding happen in your browser. Nothing is sent anywhere unless you choose "Get a link" on a decoded file.

Why is the Base64 bigger than the file?

Base64 uses 4 characters for every 3 bytes, so it's about a third larger. That's why it's best for small images like icons and logos.

Can I convert other files, like PDFs?

Yes. Any file works; the data URI starts with that file's type, for example data:application/pdf;base64,…

Got a file? Get a link.

Free, no sign-up, and gone in 4 hours.

Upload a file