Nodes/KJNodes for ComfyUI/Append Strings To List
ComfyUI Node Runs on cloud

Append Strings To List

Build a string list from two inputs

By kijai·Created 3 years ago·Updated 26 days ago· 3,361
Append Strings To List
    • STRING
    ◄string1►
    ◄string2►

    This is one of those tiny plumbing nodes that only makes sense once you understand ComfyUI's "list" concept, so let's start there. Most nodes in ComfyUI process one thing at a time. But ComfyUI also has a mode where a single output can carry a list of values, and when a downstream node receives a list it runs once per item automatically. That's how you get a batch of prompts, a batch of settings, a sweep. AppendStringsToList exists to help you assemble one of those string lists by hand.

    It ships in kijai's KJNodes, the utility-heavy pack that's on more machines than almost any other. Nothing here is glamorous, but this is the kind of node that quietly unblocks a batch workflow.

    How it works

    You give it two strings and it hands back a list containing both, in order. The name says "append," and the real value shows up when you chain these: the output of one AppendStringsToList feeds into the next, and each stop adds another entry, so you grow a list of arbitrary length by daisy-chaining. It's the manual, visual way to construct a small string list without writing any code or wrangling a spreadsheet node.

    Where you'd reach for it: feeding a handful of distinct prompts into an encoder that then runs your sampler once per prompt, or assembling a set of filename suffixes, tags, or wildcards you want iterated over in a single queued run.

    The inputs and outputs that matter

    There's not much surface here, which is the point:

    • string1 and string2 - the two strings to combine into the list. Both default to empty. Type them in directly, or wire text in from other nodes.

    The output is a single STRING slot, but it carries a list of the two values rather than one concatenated blob. That distinction matters: this does not glue "cat" and "dog" into "catdog". It produces the two-item list ["cat", "dog"], and whatever you connect it to will process each item separately. If what you actually wanted was to join two strings into one, this is the wrong node, you want a concatenate/combine node instead.

    Installing it

    Odds are you already have KJNodes. If not, grab it through ComfyUI Manager by searching KJNodes for ComfyUI, install, and restart. Manual route:

    cd ComfyUI/custom_nodes
    git clone https://github.com/kijai/ComfyUI-KJNodes
    pip install -r ComfyUI-KJNodes/requirements.txt
    

    Restart ComfyUI afterward. No models, no heavy dependencies for this one.

    Common issues

    "It's concatenating my strings into gibberish." It isn't, actually. It's building a two-item list and the node you fed it into is iterating over it, which can look like scrambled output if you expected a single value. If you truly want one merged string, use a string-concatenate node, not this.

    Downstream node only runs once. Whatever receives the list has to support list processing for the per-item behavior to kick in. Most text-consuming nodes do, but if yours collapses the list, that's a limitation on the receiving end, not here.

    I need more than two entries. Chain them. The output of one feeds the string1 (or string2) input of the next, and each node in the chain adds an item. It's a bit fiddly past three or four, at which point a dedicated batch/wildcard node is usually the cleaner tool.

    CategoryKJNodes/text

    Inputs (2)

    NameTypeDefaultDescription
    string1STRING—
    string2STRING—

    Outputs (1)

    NameTypeDescription
    STRINGSTRING—