Nodes/ComfyUI ARG Toolkit/Base64 to String Converter
ComfyUI Node

Base64 to String Converter

Turn That =Padded Wall of Text Back Into Words

By AzelusLightvale·Created 12 months ago·Updated about 10 hours ago· 1
Base64 to String Converter
    • converted_txt
    textHello World!
    encoding_format
    other_encoding_format

    Every ARG, at some point, hands you a string that ends in an equals sign and contains letters, digits, +, and / - and your brain says "that's base64." Base642String is the node that finishes the thought: paste the base64 in, get the decoded text out. It's one half of the pack's base64 round-trip (the other half is String2Base64), and it's the utility that connects the "weird encoded text" stage of a puzzle to the "oh, it's a message" stage.

    The mechanism is a straight decode: the node takes your input, decodes it as ASCII base64, then interprets the resulting bytes using the encoding format you pick. That second step is the part people forget. Base64 is an encoding, not an encryption - it turns bytes into text. Which bytes you get out, and how they render as a string, depends entirely on the encoding_format you select, because the same base64 blob could represent UTF-8, UTF-16, Latin-1, or something else entirely depending on how it was produced.

    The inputs

    • text - the base64 string to decode.
    • encoding_format - the dropdown: utf-8, utf-16, utf-32, ascii, latin-1, cp1252, utf-8-sig, or Other. utf-8 is the right answer 95% of the time. If your decoded output is mojibake (à la "é" where an é should be), you picked the wrong one or the original wasn't UTF-8 - try latin-1 and cp1252 before assuming the node is broken.
    • other_encoding_format (optional) - when the dropdown doesn't have what you need, pick Other and type any codec name Python's encoding module knows. This is how you'd decode, say, a shift-JIS blob.

    Output is converted_txt (STRING).

    Where people get burned

    Three classic traps. First: decoding non-text data. Base64 is used for images and binary blobs too; if you decode a base64 PNG as UTF-8, you'll get a wall of replacement characters and a crash on the decode step, not a picture. Base642String is a string converter - for binary data, use the pack's ByteslikeDecode or feed the bytes into an image node instead. Second: whitespace and newlines. Long base64 gets line-wrapped when copied; the pack's decode handles the string as given, and stray newlines can break the decode - strip them or use a string-cleanup node. Third: expecting a symmetric answer to String2Base64. These two nodes are not inverses in the way you'd hope if the encodings don't line up. Encode with UTF-8, decode with UTF-16, and you get garbage - matching the encoding on both sides is the whole game.

    Installing it

    Part of the ARG Toolkit pack:

    cd ComfyUI/custom_nodes
    git clone https://github.com/AzelusLightvale/ComfyUI-ARG-Toolkit
    

    Restart and find it under ARG Toolkit → Utilities → Converter (ComfyUI Manager: search "ComfyUI ARG Toolkit"). This node is pure Python stdlib - base64 and codecs - so there's no extra dependency beyond what the pack already installs. Nothing heavy, no models.

    Troubleshooting

    • Decoded text is mojibake → switch encoding_format. Try latin-1/cp1252 for legacy sources.
    • Decode error → the string isn't valid base64, or has stray newlines. Clean it first.
    • Output looks like binary garbage → the blob wasn't text to begin with. Use ByteslikeDecode or an image decoder.

    Base64 isn't security - anyone with the string can decode it. But as the workhorse "carry bytes through text-only channels" format, it's everywhere in puzzles, and this node is the fastest way to see what a clue is actually saying.

    CategoryARG Toolkit/Utilities/Converter

    Inputs (3)

    NameTypeDefaultDescription
    textSTRINGHello World!
    encoding_formatCOMBOThe encoding format available for text, may yield different results when converting.
    other_encoding_formatoptSTRINGIf, for some reason, your chosen encoding format is not available in the dropdown, select "Other" in encoding_format and type in your encoding format here. Supports all format written in Python's `encoding` module.

    Outputs (1)

    NameTypeDescription
    converted_txtSTRING