How Magic-Byte Sniffing Recovers Missing Image MIME Headers
APIs, webhook payloads, and database blobs frequently store raw Base64 strings without the RFC 2397 data:image/png;base64, header. Because the first 3 to 12 bytes of every major image container contain a fixed file signature, the opening Base64 characters immediately reveal the format: iVBORw0KGgo identifies PNG (89 50 4E 47), /9j/ identifies JPEG (FF D8 FF), R0lGOD identifies GIF87a/GIF89a, and UklGR identifies RIFF/WebP.
ByteHelpers strips surrounding JSON quotes or line breaks, sniffs the binary header automatically, renders a live sandboxed preview with a checkerboard transparency backdrop, and lets you export the decoded file directly from browser memory.
- Magic Prefix DetectionRecognizes iVBOR (PNG), /9j/ (JPEG), R0lGOD (GIF), UklGR (WebP), PHN2Zy / PD94bW (SVG), and AAABAA (ICO).
- Inspectable MetadataShows decoded MIME type, natural pixel dimensions (width × height), decoded byte size, and Base64 overhead.
- Local Blob DownloadConverts decoded bytes into a local Object URL for one-click download with the matching file extension.
Why does my Base64 image start with /9j/ or iVBORw0KGgo?
Those are the Base64 representations of binary magic headers: FF D8 FF (JPEG SOI + marker) encodes to /9j/, while 89 50 4E 47 0D 0A 1A 0A (PNG signature) encodes to iVBORw0KGgo.
Can I paste a Base64 string copied directly from a JSON response with escaped slashes?
Yes. ByteHelpers cleans JSON-escaped \/ sequences, surrounding quotes, and whitespace before decoding the binary payload.
Are decoded images uploaded anywhere to generate the download link?
No. Downloads are created locally using Uint8Array and URL.createObjectURL(new Blob(...)) inside your browser tab.