Split String to List
Turn one text blob into a batch ComfyUI can iterate
- TEXT
There's a question that comes up constantly on r/comfyui in one form or another: "I have a wall of text with a bunch of prompts in it, separated by some marker - how do I turn that into a batch that runs through my workflow one prompt at a time?" Split String to List is the direct answer. It's a one-job node from a tiny pack called ComfyUI-TextUtils, and its job is exactly what the name says: take a string, cut it at every occurrence of a separator, and hand back a list.
The reason that matters in ComfyUI specifically is the list-fan-out execution model. When a node's output is flagged as a list (this one is), ComfyUI doesn't treat it as one value - it treats every downstream node that consumes it as something to run once per item, automatically. So wire this node's output into a CLIPTextEncode (or a save node, or anything else that takes a plain string), and instead of one run you get one run per split chunk. No batch-loop node, no scripting - split the text and the rest of the graph just multiplies out on its own.
How it works
Under the hood it's one line: text.split(separator). That's Python's stock str.split(), nothing fancier - no regex, no trimming whitespace, no dropping empty entries. It's predictable, but that predictability cuts both ways, which is the whole troubleshooting section below.
Inputs and outputs
text- the whole blob you want to cut up. Defaults to empty.separator- what to split on. Defaults to/, but you'll almost always change this to whatever actually delimits your content (a custom marker like++++, a comma, whatever you used).- Output:
TEXT- a list of strings (noteis_list: true), not a single string. That's the whole point - it's what triggers the auto-batch behavior downstream.
How to install it
Two ways, same result:
- ComfyUI Manager - open Manager, search "ComfyUI-TextUtils", install, restart.
- Manual:
then restart ComfyUI.cd ComfyUI/custom_nodes git clone https://github.com/wutipong/ComfyUI-TextUtils
There's genuinely nothing else to it. The whole pack is four Python files with no requirements.txt - it's plain standard-library string operations wrapped as nodes. No pip installs, no model downloads, nothing to go wrong on the install side. (There's also no README in the repo at all, for what it's worth - what you're reading here is reverse-engineered straight from the node source, not summarized from docs the author never wrote.)
Common issues & troubleshooting
Empty separator crashes it. If you clear the separator field out to nothing, Python's str.split("") throws a ValueError: empty separator - it's not a ComfyUI bug, it's what the underlying function does. Always leave something in that field.
Leading, trailing, or doubled-up separators give you blank entries. "a/b/" split on / gives you ["a", "b", ""] - that trailing empty string is a real list item. If your source text starts or ends with the separator, or has it twice in a row, you'll get an empty prompt (or blank filename, or whatever) sitting in your batch. Worth eyeballing your input before you queue a big run.
Typing a multi-line delimiter into the widget is awkward. If your separator is a newline rather than a visible character, a single-line node widget isn't a friendly place to enter that. You're better off staging your source text in a proper multiline text node upstream and wiring it in, rather than fighting the widget.
The fan-out surprises people the first time. If you expected one output and suddenly your sampler queues five runs, that's this node doing exactly what it's supposed to - check how many items your split actually produced (usually because of the blank-entry issue above) before assuming something broke.
If you need to collapse the list back down afterward - say, to log what you split, or reassemble a subset - that's what this pack's join nodes are for.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| text | STRING | — | |
| separator | STRING | / | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| TEXT | STRING | — |