IMAGE BASE64 TOOL● Browser-local

IMAGE UTILITY / 02

Base64 to image

Base64 to image: paste a Base64 string and get the picture back — plus a line-by-line verdict on whether the string arrived intact. Decoding happens in your browser. Nothing is uploaded.

01 / Paste the string

Raw Base64 is expected, but a full data: URI, an <img> tag or a CSS url() all work; the wrapper is stripped first. Line breaks, spaces, no-break spaces and the URL-safe alphabet are handled too.

02 / Decoded image

Waiting for a string
Decoded image

Is this string intact?

    For base64 to jpg or base64 to jpeg, paste your JPEG's Base64 string here to preview and download the decoded image.

    Three ways a Base64 image string arrives damaged

    Every broken string comes down to one of three things, and they do not share a fix. Telling them apart is the whole job.

    Cut short

    Bytes at the end never made it. A chat app truncated the message, a terminal buffer ran out, a copy stopped early, a line got dropped when the text was re-wrapped.

    Lost a character

    One character went missing somewhere in the middle — a joined line, a stray edit, a find-and-replace that ate a +. Everything after the gap shifts, so the damage is not confined to where the character went.

    Padding out of place

    Base64 pads the final group with = so the length divides by four. When that = is missing, or sits somewhere it cannot, the decoder refuses the string outright. This is often a symptom rather than the fault itself: it is what losing a character looks like on a string that ended in padding.

    A preview is not evidence

    Every decoder you have used shows you a picture when it can and an error when it cannot. That sounds like a test. It is not. I took one 640 × 360 PNG — 5,879 bytes, 7,840 Base64 characters — and damaged copies of it in a script, then asked Chromium to load each one and compared every rendered row against the intact picture, pixel by pixel.

    What I did to the stringWhat the browser didWhat the bytes sayRows still identical
    Removed the final character (the =)loads, reports 640 × 3605,879 bytes — nothing lost360 of 360
    Removed 10 charactersloads, reports 640 × 3605,872 bytes, IEND chunk gone360 of 360
    Removed 40 charactersloads, reports 640 × 3605,850 bytes358 of 360
    Cut 2% off the endloads5,762 bytes340 of 360
    Cut 10% off the endloads5,292 bytes287 of 360
    Cut 25% off the endloads4,410 bytes280 of 360
    Cut 50% off the endloads2,940 bytes268 of 360
    Cut 75% off the endloads1,470 bytes144 of 360
    Changed one character, at position 3,920loads5,879 bytes, IDAT checksum fails268 of 360
    Deleted one character, at 10% indecoder refuses the string——

    Two rows in that table are the reason this page exists. Removing the last ten characters deletes the PNG end marker, and the picture still comes back identical in all 360 rows. Cutting half the file away still loads and still gets 268 rows right.

    So "it rendered" tells you almost nothing. A decoder that draws a picture has only told you the header was readable.

    The shape of the decay is worth noting too: content disappears far more slowly than bytes do. Losing half the bytes cost me 26% of the rows, not 50%.

    JPEG behaves the same way in outline and worse in one specific spot. Same picture, re-encoded at quality 0.92: 15,084 bytes, 20,112 Base64 characters, and — because the byte count divides by three — no padding at all.

    What I did to the stringWhat the browser didWhat the bytes sayRows still identical
    Removed 1 characterloads15,083 bytes, FF D9 marker gone350 of 360
    Cut 10% off the endloads13,575 bytes286 of 360
    Cut 25% off the endloads11,313 bytes270 of 360
    Cut 50% off the endloads7,542 bytes254 of 360
    Cut 75% off the endloads3,771 bytes158 of 360
    Deleted one character, at 10% inloads, all 360 rows painted15,083 bytes63 of 360
    Deleted one character, at 50% inloads, all 360 rows painted15,083 bytes255 of 360
    Deleted one character, at 90% inloads, all 360 rows painted15,083 bytes287 of 360

    Those last three are the nasty case. Nothing errors. The image box fills completely. And depending on where the character went missing, up to 83% of what you are looking at is wrong.

    The five things this page checks

    1. Length over four

    Base64 turns three bytes into four characters, so an undamaged string always divides by four. A remainder of one is fatal and unconditional: I appended each of the 64 alphabet characters in turn to a string sitting at remainder one, and all 64 came back refused. Remainders of two and three still decode — with something missing.

    2. Where the = sits

    Padding is only ever the last one or two characters, and removing it has to leave a length divisible by four. A 7,839-character string ending in = is refused; the same length without that = decodes cleanly. Three or more = at the end is refused too. This check is what catches a lost character on any string that ended in padding — knock one character out of the middle and the = is left standing somewhere it is not allowed to be.

    3. The signature at the front and the marker at the end

    A PNG opens with 89 50 4E 47 0D 0A 1A 0A and closes with its IEND chunk. A JPEG opens with FF D8 FF and closes with FF D9. Missing end marker means missing bytes.

    For PNG you can be very exact about this. Across twelve PNGs I generated, from 1 × 1 up to 640 × 360, the Base64 always began with iVBORw0KGgo, and it always ended with one of exactly three strings — one per value of the byte length modulo 3:

    Bytes mod 3The string always ends with
    0AAAAAElFTkSuQmCC
    1AABJRU5ErkJggg==
    2AAAASUVORK5CYII=

    For these specimens, which end directly after IEND, a different ending indicates that the expected ending was not preserved. A file containing bytes after IEND needs a separate boundary check, as the experiment below shows. JPEG has no equivalent: the FF D9 lands on different characters depending on the byte count, so the only honest test is to decode and look at the last two bytes. My JPEG samples all opened with /9j/ followed by 4AAQSkZJ, but those eight characters are the JFIF header and every sample came from the same Chromium encoder, so do not expect them everywhere.

    4. Every PNG chunk's own checksum

    Each PNG chunk carries a CRC32, and browsers do not check them. Change one character in the middle of a PNG string and Chromium loads it happily and draws 268 rows correctly before sliding off — while the IDAT chunk's CRC32 fails on the spot. This page walks the chunks and verifies each one, so that class of damage gets caught instead of being shown to you as a picture.

    5. Declared rows versus painted rows

    The header states a height; this page draws the result and counts how many rows actually came back with pixels. When the two disagree, the image ran out partway. Cut half the bytes off a PNG and Chromium still reports 640 × 360 and still fires its load event, while only 268 rows have anything in them.

    How each one is fixed

    What this page cannot tell you

    How these numbers were produced

    One 640 × 360 PNG, 5,879 bytes, encoded to 7,840 Base64 characters ending in a single =. The same picture re-encoded as JPEG at quality 0.92, 15,084 bytes, 20,112 characters, no padding. Every damaged copy was generated by script rather than by hand, so the damage is exactly what it says it is.

    Each copy was decoded, loaded into an image element, drawn to a canvas, and compared row by row against the intact render. "Rows still identical" counts rows from the top that matched the intact picture exactly; "painted" counts rows holding any non-transparent pixel. Tests ran in Chromium on Windows. It is one image in one browser, so treat the percentages as the shape of the problem rather than as constants.

    Related

    Image to Base64 converter — the other direction: turn a file into Base64, a data URI, an img tag or a CSS background.

    How do I turn base 64 to image?

    Paste the encoded image into the tool above and inspect the recovered picture and integrity results.

    How do I use a base64 to image converter?

    Supply the encoded image string rather than an image file. For a request written as base64 convert image, the operation on this page is decoding the string back to an image.

    To extract printed English from an image, use Image to Text.

    For a downloadable JPEG with explicit transparency handling, use PNG to JPG.

    To export an uploaded JPEG as a PNG without claiming to recover discarded detail, use JPG to PNG.

    For a complete embeddable data URL, use the image to base64 converter tool.

    A PNG ending before the decoded file ends

    Decode the complete Base64 value to recover its bytes. A readable picture does not establish that the decoded file ends exactly at its image boundary: our controlled PNG specimens retain deliberately appended bytes after IEND.

    We generated a 32 by 24 PNG for this experiment. The clean file contains 2,308 bytes and ends immediately after IEND. We then made three separate copies by appending known public test bytes after that ending chunk. We did not edit the original chunk stream or insert information taken from a visitor file.

    The first suffix is the literal ASCII word NOTE, four bytes written as 4E 4F 54 45. The second suffix is public-demo-tail, sixteen ASCII bytes. The final suffix contains the thirty-two consecutive byte values from hexadecimal 00 through 1F. These are three deliberately different endings rather than three descriptions of the same damaged file.

    Each complete file was encoded separately using Python Base64. We decoded each resulting string with strict alphabet validation and compared every returned byte against the complete input. All four comparisons matched. A strict Base64 decode therefore retained the suffix in these tests. This is not a claim that the suffixed files are conforming PNG files.

    The clean specimen produces 3,080 Base64 characters. Appending NOTE increases the complete file to 2,312 bytes and its Base64 value to 3,084 characters. The sixteen-byte suffix gives 2,324 bytes and 3,100 characters. The thirty-two-byte suffix gives 2,340 bytes and 3,120 characters. None of these counts includes a data URL wrapper.

    We inspected the ending boundary by walking the generated PNG chunk stream, beginning after its signature. For each chunk we read its declared data length and advance over the length field, chunk type, data and CRC field. We stop after the IEND chunk. In all four specimens the resulting ending offset is 2,308.

    Subtracting that boundary from the complete file size gives zero, four, sixteen and thirty-two bytes after IEND. That is the specific result recorded in our table. It is a structural boundary observation, not a recalculated-checksum verdict. The experiment leaves the original image chunks unchanged, so it does not test how a reader responds to a corrupted IDAT chunk.

    There is a necessary restriction on this procedure. We already know how our generated files were constructed. Searching arbitrary data for the printable letters IEND is not equivalent to walking a PNG chunk stream: those letters might occur inside some other data. A general inspector must establish a valid boundary before treating everything after it as trailing data.

    Next we opened each complete specimen with Pillow 12.3.0. This particular reader accepted all four and returned identical RGBA arrays. Each array contains 3,072 bytes. We compared those bytes directly with the generated input. We did not use successful opening, matching width and height, or a screenshot as a substitute for that byte comparison.

    This reader result is deliberately scoped. It does not establish how a browser, email application, upload service or another library treats the same suffix. A reader can accept an image while other software rejects the complete file. The test records what Pillow did with our four files; it is not a universal compatibility statement.

    The two successful observations answer different questions. Encoding and decoding preserved the complete input, including our note. The PNG chunk walk still reached IEND before the end of three inputs. Seeing our colored tile does not erase that distinction. Neither observation establishes whether an unfamiliar input was intended to contain extra material.

    To reproduce the smallest suffix, append the four bytes NOTE to the supplied clean file with a binary-safe script or editor. Encode the complete saved result. After decoding, examine its final four bytes. Our result ends with 4E 4F 54 45. Appending the printable text 4E4F instead would create a different four-byte suffix and would not reproduce the NOTE specimen.

    The second suffix ends with the hexadecimal sequence 7075626c69632d64656d6f2d7461696c. The final specimen ends with 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f. Those exact endpoints allow the round trip to be checked without trusting an image preview. Their content is deliberately public and synthetic.

    A download that looks correct is not automatically identical to a source file. Conversely, an extra suffix does not by itself prove malicious intent. We know why this material is present because we created it. This experiment does not classify unknown content, identify its author or establish whether any particular application should accept it.

    We do not silently trim these specimens. Removing their suffix would make a different file, even if the same reader still displays the same pixels. Keep an untouched original when investigating an unexpected ending. If the actual source file is available, compare the complete recovered file with that source rather than comparing only the displayed picture.

    The converter above remains an image decoder. This article does not claim it already supplies a general trailing-data inspector or automatically repairs unexpected bytes. The downloadable specimens document the difference between recovering an image and checking a file boundary. Applications requiring strict file validation need to apply their own documented acceptance requirements.

    The outcome is reproducible without uploading private material: four generated files, four strict Base64 round trips, one measured IEND boundary and three known suffixes. A different reader's behavior should be recorded separately. The measurements here do not justify saying that every tool preserves extra bytes, that every image viewer ignores them, or that a visible image proves the absence of hidden material.

    SpecimenFile bytesEnd of IENDTrailing bytesBase64 characters
    trailing-0.png2308230803080
    trailing-1.png2312230843084
    trailing-2.png23242308163100
    trailing-3.png23402308323120

    Download the generated specimens: trailing-0.png · trailing-1.png · trailing-2.png · trailing-3.png

    Watch the experiment

    Watch on YouTube

    Measured specimen 1 values
    Measured values for specimen 1.
    Measured specimen 2 values
    Measured values for specimen 2.
    Measured specimen 3 values
    Measured values for specimen 3.
    Measured specimen 4 values
    Measured values for specimen 4.
    Visible image or intact file?

    Related experiment: How to Stream Base64 into UTF-8 Text in Python — watch on YouTube.