Convert Image to Base64

Turn any photo into a Base64 string you can paste straight into HTML, CSS, or code — encoded on your device, with no upload.

Click to choose an image
from your phone or computer, or drop a file here

No image loaded yet.

Honest note: Base64 text is about 33% larger than the original file, so it is best for small images and icons you want to embed in code — not for sharing large photos. The encoding runs entirely in your browser; your image is never uploaded.

Original

How to convert an image to Base64

  1. Choose an image, or drag and drop it above.
  2. Pick the output format: the full data URL for use in an <img> tag or CSS, or the raw Base64 code only for APIs that ask for just the code.
  3. Click Convert to Base64, then copy the text or tap Download .txt file to save it. Nothing is downloaded before you tap Download.

What is Base64, and why is the text so long?

Base64 is a way of writing binary data — like a photo — as plain text characters, so it can live inside HTML, CSS, JSON, or source code where a file cannot. The trade-off is size: the text version is roughly one third larger than the original image, which is why this tool suits logos, icons, and small images rather than multi-megabyte photos.

Frequently asked questions

Is my image uploaded?

No. The encoding runs on your device, in your browser.

What is the difference between the full data URL and the raw code?

The full data URL starts with data:image/jpeg;base64, (or the matching type for your file) and works directly as an image source in HTML or CSS. The raw code is the same string without that prefix, which is what some APIs and code libraries expect.

Can I paste the result into HTML?

Yes. With the full data URL selected, paste it as the src of an <img> tag and the image displays without a separate file.

Does converting change my image?

No. This tool encodes your exact original file — it does not resize, recompress, or change a single pixel.