🧩

Base64 to Image

Decode a base64 string into a downloadable image file.

POST 1 credit /v1/convert/base64-to-image
curl -X POST "https://convert.toolkitapi.io/v1/convert/base64-to-image" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{"image": "iVBORw0KGgo...", "format": "png", "filename": "logo.png"}'
import httpx

resp = httpx.post(
    "https://convert.toolkitapi.io/v1/convert/base64-to-image",
    json={"image": "iVBORw0KGgo...", "format": "png", "filename": "logo.png"},
)
print(resp.json())
const resp = await fetch("https://convert.toolkitapi.io/v1/convert/base64-to-image", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
  },
  body: JSON.stringify({"image": "iVBORw0KGgo...", "format": "png", "filename": "logo.png"}),
});
const data = await resp.json();
console.log(data);
# See curl example
Response 200 OK
Binary image file streamed as a download (Content-Type reflects format)

Description

Decode a base64 string into a downloadable image file.

How to Use

1

1. POST the base64 string in the `image` field.

2

2. Optionally set `format` (default: auto-detect), `quality`, and `filename`.

3

3. Save the streamed image file.

About This Tool

Decodes a base64 image string into a real image file and streams it back as a download. Optionally re-encodes into a different target format and quality.

Great for turning JSON-embedded image data (like OpenAI image outputs or database-stored base64) into downloadable files without client-side decoding.

Why Use This Tool

Frequently Asked Questions

Do I include the `data:` prefix?
Both plain base64 and `data:image/...;base64,…` strings are accepted.
What if the format doesn't match the data?
The service re-encodes into the requested `format`, transparently handling the format change.
Is there a size limit?
Base64 payloads are capped at the server-configured request-body limit.

Start using Base64 to Image now

Get your free API key and make your first request in under a minute.