Decode Base64 image info
The Base64 image information tool checks a complete image data URI and reports two practical facts: the MIME type declared in its header and the number of bytes represented by its encoded payload.
Run — free
Runs in your browser. Free, unlimited — your data never leaves this page.
It performs the work locally, without fetching a URL, uploading an image, guessing a file extension, or inspecting remote content. Strict validation catches missing markers, invalid characters, incorrect padding, noncanonical unused bits, and non-image media types, making the result suitable for form validation, storage planning, logging, and automated ingestion checks.
Read the information already carried by a data URI
A Base64 image data URI combines metadata and encoded bytes in one string. Its header identifies the media type, while the payload represents the original binary data in groups of printable characters. This capability separates those parts only after confirming that the whole value follows the expected structure. A successful result contains `mime_type`, such as `image/png`, and `byte_length`, the exact number of decoded bytes. It does not estimate size from character count alone: it accounts for the final Base64 padding characters, which indicate whether the last group represents one, two, or three bytes. The tool deliberately reports the declared MIME type rather than claiming to recognize an image from its binary signature. That distinction matters when you are validating an API request or examining generated markup. You learn exactly what the data URI says and how large its decoded payload is, without silently changing, normalizing, or re-encoding the supplied value.
Understand what strict validation rejects
The accepted form is a complete `data:image/type;base64,payload` value. The media type must begin with `image/`, the Base64 marker must be present, and a single comma must separate the header from the payload. The payload must use the standard Base64 alphabet, have a length divisible by four, and place padding only at the end. Validation also checks unused bits in the final encoded group. This catches noncanonical strings that permissive decoders may accept even though multiple spellings could represent the same bytes. Empty payloads, embedded whitespace, URL-safe Base64 characters, extra metadata parameters, missing padding, and ordinary web URLs are rejected as malformed input. These constraints provide a predictable contract for automation. If your source produces a raw Base64 fragment rather than a complete data URI, add the correct image MIME header before calling the capability. If it produces Base64url, convert it to canonical standard Base64 first instead of relying on decoder tolerance.
Use byte length without exposing or transferring the image
Knowing decoded byte length before storing or forwarding an image is useful in upload gates, database checks, message-size limits, and observability pipelines. You can reject an oversized inline asset before another service parses it, record consistent size metadata alongside HTML or JSON, or compare the overhead of inline images with linked resources. The calculation is deterministic and needs no external network access. It scans the supplied string, validates its syntax, and derives the byte count from complete Base64 groups and terminal padding. No URL is followed, no remote MIME type is consulted, and no timestamp or random identifier appears in the output. The browser runner and API therefore return the same two fields for the same input. This capability does not verify that the decoded bytes truly match the declared image format, calculate image dimensions, repair corrupted files, or return the decoded binary. Use it when structural validation and exact payload size are the questions; use a format-aware image inspector when content verification is required.
What you can do with it
Enforce inline image limits
Check decoded byte length before accepting a Base64 image embedded in an API request, document, or form submission.
Inventory generated data URIs
Record the declared image MIME type and binary size for assets emitted by an editor, exporter, or build pipeline.
Reject malformed image input early
Validate canonical Base64 syntax before passing inline image data to storage, rendering, or image-processing systems.
FAQ
What does the capability return?
It returns `mime_type`, copied from the validated data URI header, and `byte_length`, calculated from the canonical Base64 payload.
Does it upload or fetch the image?
No. It performs deterministic local string validation and size calculation without external network access.
Does the MIME type prove that the bytes are really that image format?
No. The result reports the validated MIME declaration. It does not inspect file signatures or decode image dimensions.
Why was my Base64 value rejected?
Common causes include a missing data URI header, a non-image MIME type, whitespace, URL-safe characters, incorrect padding, an empty payload, or non-zero unused bits.
How much does it cost?
The browser tool is free to run on this page. API automation costs $0.002 per request.
For developers — API access
Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.
API endpoint
Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/image/from-base64-info \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"data_uri":"https://ejemplo.com/imagen.jpg"}'const res = await fetch("https://api.kit.forhosting.com/image/from-base64-info", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"data_uri": "https://ejemplo.com/imagen.jpg"
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/image/from-base64-info",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"data_uri": "https://ejemplo.com/imagen.jpg"
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/image/from-base64-info", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"data_uri":"https://ejemplo.com/imagen.jpg"}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"data_uri":"https://ejemplo.com/imagen.jpg"}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/image/from-base64-info", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"data_uri": "https://ejemplo.com/imagen.jpg"
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "image.from_base64_info",
"status": "queued",
"_links": {
"result": "/tasks/tsk_…/result"
}
}The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Limits
max_chars | 13981053 |
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |