Skip to content
UniKit

Base64 image inspector

Turns base64 or a data URL back into an image: the real format is detected from magic numbers (PNG / JPEG / GIF / BMP / WebP, the MIME prefix is not trusted), width and height are read straight from the file header, and you get a paste-ready <img> snippet plus the data URL.

Runs in your browserEvery computation happens in your browser — your data never leaves this device.

Image base64 or data URL

The MIME prefix is not trusted: the format comes from magic numbers (PNG / JPEG / GIF / BMP / WebP) and the size is read straight from the file header.

Inspection result

Parsed by local pure logic: nothing is uploaded and pixels are never decoded.

Paste base64 to see the format, size and a ready-to-use snippet

What this tool does

  • When an API returns an image as base64, confirm what it really is and how big: the format comes from the file header, not from the data: prefix.
  • Turn base64 into something usable: a data URL or an <img src="data:…" width height alt> snippet you can paste into HTML or Markdown.
  • Debug "the image does not render": if the prefix says image/png while the header is JPEG, the result reports declared-mime-mismatch so you can see which side is wrong.
  • Check the payload size quickly (for example whether inlining a 200 KB image is worth it).

Example

Input

iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNk+A8AAQUBAScY42YAAAAASUVORK5CYII= (a 1×1 PNG; data URL on, <img> snippet off)

Output

format: png
mime: image/png
size: 1 × 1
bytes: 68
data-url: data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNk+A8AAQUBAScY42YAAAAASUVORK5CYII=

Turning on the <img> snippet adds one more line: html: <img src="data:image/png;base64,…" width="1" height="1" alt="png image">.

Frequently asked questions

Which formats are supported and how are they detected?

PNG, JPEG, GIF, BMP and WebP, all detected from magic numbers (89 50 4E 47 for PNG, FF D8 for JPEG, GIF8 for GIF, BM for BMP, RIFF…WEBP for WebP). The MIME declared in the data: prefix is not trusted; when the prefix disagrees with the real format an extra declared-mime-mismatch line is printed.

How are the dimensions obtained?

Straight from the file header: PNG reads width and height from IHDR (offsets 16 and 20), GIF from the logical screen descriptor, BMP from BITMAPINFOHEADER, JPEG by scanning for an SOFn segment, and WebP handles the VP8, VP8L and VP8X sub-formats separately. Only bytes are parsed - pixels are never decoded and nothing is rendered.

Why does it say the base64 is invalid?

The check is deliberately simple: after removing whitespace the payload must contain only A-Z a-z 0-9 + / plus trailing = characters, and its length must be a multiple of 4 (RFC 4648). Pasted line breaks, missing padding or a truncated copy all trigger this error.

Does it upload the image or use the network?

No. Parsing happens synchronously in your browser with no network request, and the image data is never written to localStorage.

Can it handle multi-megabyte base64?

It parses, but everything runs on the main thread: turning tens of megabytes of base64 into a byte array costs a lot of memory, so keep inputs within a few megabytes. The tool only reads the header and the length, so the cost scales with the input size rather than the pixel count.

Keywords:Base64 image inspectorbase64-imageofflinedeterministic

Related tools