ComfyUI Node Runs on cloud

Join Strings

Glue two strings together with a delimiter

By kijai·Created 3 years ago·Updated about 12 hours ago· 2,930
Join Strings
    • STRING
    delimiter
    string1
    string2

    Exactly what it sounds like, and there's no shame in needing it. JoinStrings takes two strings and concatenates them with a delimiter of your choice. That's the whole node. It exists because in a graph, "stick these two bits of text together" is a real, recurring need - combining a base prompt with a dynamic suffix, tacking a trigger word onto a caption, building a filename out of parts - and doing it with a proper node beats jamming everything into one text box.

    Where it fits

    Text plumbing is underrated in ComfyUI. Once you start feeding prompts from multiple sources - a style fragment here, a subject there, a LoRA trigger word that has to be present - you want to assemble the final string from pieces rather than duplicating the whole prompt everywhere. JoinStrings is the two-input version of that. You wire two STRING sources in, pick what goes between them, and get one string out to feed your text encoder, your filename prefix, or the next join in a chain.

    If you find yourself needing three, five, ten pieces, or a whole batch, reach for its bigger sibling JoinStringMulti instead - but for the common "prefix + suffix" case, this is the lean pick.

    The inputs and output

    • delimiter (default a single space " ") - what to insert between the two strings. A space for words, , for prompt fragments, an empty string for a raw splice, _ for filenames, \n if the downstream field respects newlines.
    • string1 and string2 (both optional) - the two pieces. They're optional, so an unconnected one is treated as empty rather than erroring, which means you can leave one side blank and effectively pass the other through with the delimiter appended.

    The single STRING output is string1 + delimiter + string2. Chain several of these if you need to build something in stages.

    How to install it

    It comes with kijai's KJNodes pack.

    • ComfyUI Manager - search KJNodes for ComfyUI, install, restart.
    • Manual - cd ComfyUI/custom_nodes && git clone https://github.com/kijai/ComfyUI-KJNodes, then pip install -r ComfyUI-KJNodes/requirements.txt, restart.

    No models, no dependencies. It's about as light as a node gets.

    Common issues & troubleshooting

    Double spaces or stray delimiters. If string1 already ends with a space and your delimiter is also a space, you get two. Likewise, joining with , when one part is empty can leave a leading or trailing comma. Mind what's already at the edges of your inputs, or trim upstream.

    The delimiter isn't showing up the way you typed it. A literal \n in the field may render as backslash-n rather than a newline depending on how the widget handles escapes - if you specifically need a line break and it's coming through as text, that's why. For plain separators (space, comma, underscore) it's literal and predictable.

    You actually need more than two inputs. Don't chain a dozen JoinStrings nodes into a staircase - that's precisely the mess JoinStringMulti was built to replace. Use this one when it's genuinely two, maybe three, pieces.

    CategoryKJNodes/text

    Inputs (3)

    NameTypeDefaultDescription
    delimiterSTRING
    string1optSTRING
    string2optSTRING

    Outputs (1)

    NameTypeDescription
    STRINGSTRING