imagetoolbox

Convert an image to Base64

The file as a data URL, ready to paste. Copy the raw string, an img tag or a CSS background rule.

  • Free
  • Runs on your device
  • No account
  • No limits

How to convert an image to base64

  1. Drop an image in the box above. The original file is encoded as is, byte for byte.
  2. Copy the raw data URL, the img tag or the CSS rule.
  3. Mind the size. Base64 adds about a third, so it's for small images.

When Base64 makes sense

Putting the image inside your code saves a network request. That's worth it for tiny icons and single-file pages. The text version is about a third larger than the file, so it only makes sense for small images.

The file is encoded exactly as it is. Nothing is re-compressed, so you get byte for byte what you dropped.

Like everything on this site, this tool runs in your browser. Your image is never uploaded.

Common questions

Is the base64 tool free?

Yes, properly free. No paid tier, no trial, no watermark on the result and nothing to sign up for. Put as many files through it as you like, as often as you like.

Are my files uploaded to a server?

No. The base64 tool runs inside your browser, on your own machine, so your files never go anywhere. Big ones are fine too, up to whatever your browser can hold.

When should I use a base64 image instead of a file?

For small things that would otherwise cost a separate request, such as an icon, a tiny logo or a placeholder, and for places where you can only paste text and not upload a file. For anything larger, a normal image file wins, because the browser can cache it separately and won't have to parse it again with every page.

Why is the base64 string bigger than the original file?

Because base64 rewrites the bytes using only characters that are safe to put in text, and that costs about a third more space. A 30 KB image becomes roughly 40 KB of text. It's the price of carrying a file inside a document, and the reason base64 stops being a good idea as images get larger.

What people usually do next

More tools

All image tools · PDF tools

Free to use, with no account and no limits. Everything runs in your browser, and your files never leave your device.