Nodes/String Utils/Split Text
ComfyUI Node

Split Text

Chop one long string into a batch and stop copy-pasting

By exectails·Created 2 years ago·Updated 7 months ago· 3
Split Text
    • text
    text
    split_by,

    Ever had a comma-separated list of tags sitting in one string and wished each one were its own value? That's the entire job of Split Text. It's the smallest node in the String Utils pack and the one that quietly enables half the other tricks: once text becomes a list, ComfyUI's batch machinery can iterate over it, and you stop hand-copying values one at a time.

    What it does and why you'd reach for it

    ComfyUI is fundamentally batch-oriented - a huge share of its power is feeding lists through a graph and letting it repeat. Split Text is how you turn one big string into the list those batch patterns chew on. Say a workflow hands you a comma-separated tag list as a single STRING. Split Text breaks it into individual strings, and you can then run each through your pipeline, or feed the pieces into other string nodes to process them independently. In the same pack, its inverse - Join Text - glues a list back into one string, so the two make a tidy round-trip pair.

    How it works

    Under the hood it's Python's str.split(split_by) exposed as a node: split on a literal delimiter string, get back a list. No regex, no trimming, no cleverness - just a plain split. The output is marked as a list (OUTPUT_IS_LIST), which is the thing that matters when you wire it up: this output feeds nodes that accept string lists, not nodes that want a single STRING.

    The inputs that matter

    Only two, and one of them is the star:

    • text - the string you're splitting. Note this one is forceInput: there's no text box, you have to wire the string in from another node (a Primitive, a Text Formatter, whatever produced it).
    • split_by - the delimiter, default ",". This one you can type directly. Newline, comma, pipe, ; - whatever your list uses.

    Output: text, a STRING list.

    How to install it

    This is from the exectails/comfyui-et_stringutils pack ("String Utils"). Easiest is ComfyUI Manager: search "String Utils" under Install Custom Nodes. Or clone it manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/exectails/comfyui-et_stringutils
    

    Restart ComfyUI and it'll be under exectails/Strings in the node menu. The pack has no requirements.txt and downloads no models - it's pure Python stdlib, which in an ecosystem famous for dependency hell is genuinely refreshing. You can't misinstall this.

    Gotchas

    The behavior is str.split(), and that has a couple of sharp edges people hit on the first try:

    • Consecutive delimiters leave empty strings. Splitting "a,,b" gives ['a', '', 'b'], and a trailing delimiter gives a trailing empty string. If your source has double commas, filter empties downstream or clean the text first.
    • No trimming. "a, b" splits into ['a', ' b'] - the second element keeps its leading space. If that space breaks your downstream prompt, the Text Replacer node in the same pack can clean it up.
    • It's literal, not regex. Split Text splits on the exact delimiter you type. If you need to split on a pattern (say, "on any whitespace or comma"), that's a job for the regex mode of the Text Replacer, not this node.

    One last thing: because the output is a list, beginners sometimes wire it straight into a CLIP Text Encode and wonder why nothing works. Lists need list-aware inputs. Split, transform each element, then Join Text to get a single string back before it touches your prompt encoder.

    Categoryexectails/Strings

    Inputs (2)

    NameTypeDefaultDescription
    textSTRINGThe text to split.
    split_bySTRING,The string to split the text on.

    Outputs (1)

    NameTypeDescription
    textSTRING