Nodes/ComfyUI-LogicUtils/String to Base64 Encode
ComfyUI Node

String to Base64 Encode

Make any text ASCII-safe

By aria1th·Created 3 years ago·Updated 7 months ago· 116
String to Base64 Encode
    • STRING
    string
    gzip_compressfalse

    This node takes a string and base64-encodes it - turning arbitrary text into an ASCII-safe blob that won't break JSON payloads, URLs, filenames, or anything else that gets fussy about special characters. It's filed under the image category in the node browser, which is a little odd since it doesn't touch images at all - it's pure text encoding, part of ComfyUI-LogicUtils, aria1th's grab-bag of logic and data-utility nodes.

    (If the author's name is familiar, it's from Illustrious XL - same GitHub account, under the AngelBottomless handle. Different project, same person, and this one's been quiet since January 2026.)

    How it works

    You give it a string. It runs it through standard base64 encoding and hands back a STRING - longer than the input, made of the base64 alphabet (letters, digits, +, /, = padding), and not human-readable. There's an optional gzip_compress toggle: turn it on and the text gets gzip-compressed before being base64-encoded, which can shrink the output for long or repetitive text. For very short strings, though, gzip's own header overhead (roughly 20 bytes) can make the compressed-then-encoded result longer than just base64-encoding the raw text - it only pays off once your input has some real length and repetition to it.

    Inputs and outputs

    • string - the text to encode. Required.
    • gzip_compress (optional) - gzip before encoding. Default false.
    • Output - a single STRING, the base64 result.

    Where you'd actually use it

    The realistic use case is moving text through a channel that isn't friendly to arbitrary characters: embedding a chunk of text into a filename, a URL query parameter, or a JSON field where quotes and newlines in the raw string would cause trouble. It's also a reasonable way to pack a longer note or prompt fragment into a single opaque string that another part of your workflow (or an external system consuming your workflow's output) can decode later. It's not encryption - anyone can decode base64 in one line - so don't reach for it if you actually need the text hidden, just safely transportable.

    Installing it

    ComfyUI Manager → search ComfyUI-LogicUtils → install → restart. Or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/aria1th/ComfyUI-LogicUtils
    

    No model downloads. Both base64 encoding and gzip are Python standard library, so there's nothing extra to install - consistent with a community thread that recommended this pack over WAS Node Suite and Impact Pack specifically for having no dependencies to fight. The README's own auto-install hook stays off by default (COMFYUI_LOGICUTILS_AUTO_INSTALL=1 to opt in, COMFYUI_LOGICUTILS_SKIP_INSTALL=1 to force it off).

    Common issues

    The most common surprise is exactly the gzip trade-off above: flipping gzip_compress on for a short string and getting a bigger output than expected isn't a bug, it's compression overhead losing to a small input. Only turn it on for text that's actually long enough to benefit.

    The other thing to expect: the output is base64, not readable text - if you're staring at the STRING output wondering why it looks like garbage, that's correct, and you'll need a base64 decoder on the receiving end to get your original text back. Beyond that, this pack hasn't been updated since January 2026, so treat it as a small, stable, single-maintainer utility rather than something under active development.

    Categoryimage

    Inputs (2)

    NameTypeDefaultDescription
    stringSTRING
    gzip_compressoptBOOLEANfalse

    Outputs (1)

    NameTypeDescription
    STRINGSTRING