Nodes/ComfyUI DCI/Base64 Decoder
ComfyUI Node

Base64 Decoder

Unstuffing text back into real bytes

By zccrs·Created about a year ago·Updated 11 months ago· 2
Base64 Decoder
    • Binary Data
    base64_data

    The Base64 Encoder is half the story; this is the other half. Base64 Decoder takes a base64 text string and turns it back into the BINARY_DATA bytes it encodes - the inverse of the encoder, one for one. If you've got a base64 blob sitting in a text field, a file, or a workflow and you need real bytes to feed the pack's DCI nodes, this is the door back in.

    Mechanically it's Python's base64.b64decode with a couple of niceties: the input is a multiline text field, and the node strips whitespace and newlines before decoding, so a string wrapped across multiple lines (as base64 often is in exported files) decodes cleanly instead of erroring on stray line breaks. Corrupt or invalid base64 fails gracefully - it returns empty bytes and logs a message rather than taking the whole workflow down.

    • Input: base64_data - a STRING, multiline, default empty. Paste the text directly or feed it from a text node.
    • Output: Binary Data - the decoded bytes, ready for any BINARY_DATA consumer: a Binary File Saver to write it to disk, DCI Preview to render it, DCI Analysis to inspect it.

    The canonical pattern is the round trip: load a file → encode to base64 → persist the string somewhere text-friendly → decode it later → save the file again. It's also how you'd inject a binary payload into a workflow that only stores strings, or pull one out. And since the encoder/decoder pair is symmetrical, whatever you encode here decodes exactly.

    Installing

    Same pack, same light install - Pillow and numpy only:

    cd ComfyUI/custom_nodes
    git clone https://github.com/zccrs/comfyui-dci
    cd comfyui-dci && pip install -r requirements.txt
    

    Or ComfyUI Manager → "DCI Image Export Extension" → install → restart. It sits under DCI / Files with the other binary helpers.

    Where people get burned

    • Base64 ≠ encryption. Decoding a string gives you the original data in full - never treat encoded payloads as protected.
    • Watch the whitespace. The node handles newlines, but if you hand it a string that's been truncated or mangled in transit, you'll get an error and empty output, not partial data. Base64 is all-or-nothing.
    • It pairs with the encoder, not with raw files. Feeding it arbitrary text that isn't valid base64 returns nothing useful. If you wanted to read a plain file, that's the Binary File Loader's job.

    Nothing to configure, nothing to tune. If you've got base64 and you need bytes, this is the single node that does it - and in the pack's file-handling toolkit, it's one of those pieces you quietly rely on.

    CategoryDCI/Files

    Inputs (1)

    NameTypeDefaultDescription
    base64_dataSTRING

    Outputs (1)

    NameTypeDescription
    Binary DataBINARY_DATA