Docutoolbox

Base64 image converter

Convert an image to a Base64 string, or paste Base64 text to decode it back into a downloadable image.

🖼️
Drop an image here, or click to browse
JPG, PNG, or WEBP · Max 10MB
Uploaded image preview
That doesn't look like a valid Base64 image string.
Your image and text are processed entirely in your browser - nothing is uploaded to a server.

What is Base64 image encoding?

Base64 is a way of representing binary data, like an image file, as plain text made up of letters, numbers, and a few symbols. This tool converts an image into its Base64 text form, or takes a Base64 string and turns it back into a downloadable image, all directly in your browser.

Nothing is uploaded to a server, both directions of the conversion happen locally using JavaScript.

How to use Image to Base64

  1. Switch to the "Image to Base64" tab.
  2. Drop your image onto the upload area, or click it to browse your device.
  3. The full Base64 data URI appears in the text box below the preview.
  4. Click Copy to copy the entire string to your clipboard.

How to use Base64 to Image

  1. Switch to the "Base64 to Image" tab.
  2. Paste your Base64 string or full data URI into the text box.
  3. Click Decode to image.
  4. If it's valid, a preview appears along with a download link for the decoded image file.

What is a data URI?

A data URI is a Base64 string with a small prefix that describes what kind of file it is, like data:image/png;base64, followed by the encoded data. This format lets an image be embedded directly inside HTML, CSS, or JSON without needing a separate image file, which is useful for small icons or images that need to be bundled inline with code.

Why convert an image to Base64?

  • Embedding a small image directly inside HTML or CSS without a separate file request
  • Including an image inside a JSON payload for an API
  • Storing a small image directly in a database field as text
  • Sending an image through a system that only accepts plain text
  • Debugging or inspecting how an image is encoded within a data URI

A note on file size

Base64 encoding increases the size of the data by roughly 33% compared to the original binary file, since it's representing binary data using a more limited set of text characters. This is a normal and expected part of the format, but it's worth keeping in mind for very large images, where the resulting text string can get quite long.

Frequently asked questions

Can I convert any image format to Base64?

Yes, JPG, PNG, and WEBP images can all be encoded to Base64 with this tool.

Why did decoding fail with an error?

This usually means the pasted text isn't a valid Base64 image string, check that you've copied the entire string without any missing characters or extra whitespace, and that it starts with a valid data:image/ prefix or is pure Base64 data.

Does the decoded image lose any quality?

No, Base64 encoding and decoding is a lossless, reversible process, the decoded image is byte-for-byte identical to the original that was encoded.

Is there a size limit for encoding or decoding?

Very large images will produce very long Base64 strings, which can be slow to display or copy in a browser text box, so this tool works best for reasonably sized images rather than very large, high-resolution photos.