Decode Base64 image info
Paste a Base64 image string and learn what it declares and how big it really is: a small GIF data URI comes back as image/gif and 34 bytes. Nothing is uploaded or fetched. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Runs in your browser. Free, unlimited — your data never leaves this page.
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.
What a Base64 image string contains
A Base64 image data URI packs two things into one line of text: a short header that declares the media type, such as image/png or image/gif, and the image bytes rewritten as groups of printable characters. The tool first confirms that the whole string has the expected shape, then reads the declared type and counts how many bytes the encoded part stands for. In the example, a tiny GIF comes out as image/gif and 34 bytes. Nothing is uploaded, no address is visited and the string is never changed or re-encoded.
Why the exact size and the strict check matter
Knowing the real size before you store or forward an image helps with upload limits, database checks and message-size caps. Guessing from the number of characters is not enough, because the = signs at the end decide whether the last group holds one, two or three bytes. The check is strict on purpose: a missing marker, a character outside the Base64 alphabet, wrong padding or a type that is not an image is rejected, so broken data is caught early. Keep in mind that the type reported is the one the string declares, not proof of what the bytes really are.
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. 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.
What you can do with it
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
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.
How much does it cost?
The browser tool is free to run on this page.
Why is my Base64 image rejected?
Usually something in the string is off: the data:image header or the base64 marker is missing, there are characters outside the Base64 alphabet, the = padding at the end is wrong, or the declared type is not an image.
Why not just estimate the size from the length of the text?
Because the = signs at the end change the count: they show whether the last group of characters stands for one, two or three bytes. The tool counts them, so the size it reports is exact rather than an estimate.
Related tools
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. |
Technical notes
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. It performs the work locally, without fetching a URL, uploading an image, guessing a file extension, or inspecting remote content.
Read the information already carried by a data URI
A Base64 image data URI combines metadata and encoded bytes in one string. The tool deliberately reports the declared MIME type rather than claiming to recognize an image from its binary signature. 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. 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
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. 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. 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. 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.
Use byte length without exposing or transferring the image
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. Use it when structural validation and exact payload size are the questions; use a format-aware image inspector when content verification is required.
Integration use cases
Enforce inline image limits
Check decoded byte length before accepting a Base64 image embedded in an API request, document, or form submission.
Technical questions
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.
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.