Multiline Text Splitter (Buff)
One big text block in, up to twenty smaller blocks out
- text_1
- text_2
- text_3
- text_4
- text_5
- text_6
- text_7
- text_8
- text_9
- text_10
- text_11
- text_12
- text_13
- text_14
- text_15
- text_16
- text_17
- text_18
- text_19
- text_20
Multiline text is the awkward middle child of ComfyUI. A file of captions or a list of prompt variants is great as a blob, but useless until each line is its own string you can route somewhere. MultilineTextSplitter takes a big text block and fans it out across 1–20 output sockets - one line per output, or a fixed chunk per output, whichever you need.
The workflow this enables is the batch-prompt pattern: you keep a list of prompts or subjects in a text widget (or feed it from a file), split it into individual strings, and wire each output to its own path in the graph - separate samplers, separate conditioning, separate anything. It's the "make several things from one text" valve.
How it works
It splits the input on newlines, then distributes lines to outputs in one of two ways. With split_evenly on, lines are handed out round-robin / evenly across the num_outputs fields you asked for. With it off, each output gets a fixed lines_per_output chunk in sequence - output 1 gets lines 1..N, output 2 gets the next N, and so on. Lines that don't fit in the requested number of outputs are simply dropped. remove_empty_lines strips blank lines before splitting if you want clean output.
The mechanism detail worth knowing: all 20 outputs (text_1 through text_20) exist on the backend no matter what. Set num_outputs to 3 and the other 17 return empty strings - which is exactly why this node is API-safe: a raw Prompt API workflow can connect text_7 even if the browser node only shows three sockets. Unused outputs returning "" also means downstream string consumers get a defined value instead of a missing-key error, which is friendlier than it looks.
The inputs
input_text- the multiline block.num_outputs- 1–20, how many fields you want.lines_per_output- chunk size when not splitting evenly.split_evenly- evenly distribute, or chunk sequentially.remove_empty_lines- strip blanks first.
There's no single "output" - you read whichever text_N sockets you wired up, and ignore the rest.
Install
From BuffMcBigHuge's pack - ComfyUI Manager (search "ComfyUI-Buff-Nodes") or:
cd ComfyUI/custom_nodes
git clone https://github.com/BuffMcBigHuge/ComfyUI-Buff-Nodes
Restart ComfyUI. Zero extra dependencies.
Gotchas
The traps are the ones you'd expect from a splitter. If you set num_outputs higher than the line count, the extras come back empty - fine for pipes, confusing if you expected padding. If you set it lower than the line count, lines silently fall off the end. And "split evenly" with 5 lines across 2 outputs isn't symmetric magic; check the tooltips, because the exact distribution behavior lives in the author's implementation and the README's description is the source of truth. It's a dead-simple node with a specific job: un-flatten multiline text. For prompt batching and caption fan-out, it's exactly the right tool.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| input_text | STRING | Multiline text input to split into multiple outputs | |
| num_outputs | INT | 21–20 | Number of output text fields to create |
| lines_per_output | INT | 11–1000 | Number of lines per output (used when split_evenly is False) |
| split_evenly | COMBO | False | When True, splits lines evenly across outputs. When False, uses lines_per_output for each output sequentially. |
| remove_empty_linesopt | COMBO | False | When True, removes empty lines from the input before processing. When False, empty lines are preserved. |
Outputs (20)
| Name | Type | Description |
|---|---|---|
| text_1 | STRING | — |
| text_2 | STRING | — |
| text_3 | STRING | — |
| text_4 | STRING | — |
| text_5 | STRING | — |
| text_6 | STRING | — |
| text_7 | STRING | — |
| text_8 | STRING | — |
| text_9 | STRING | — |
| text_10 | STRING | — |
| text_11 | STRING | — |
| text_12 | STRING | — |
| text_13 | STRING | — |
| text_14 | STRING | — |
| text_15 | STRING | — |
| text_16 | STRING | — |
| text_17 | STRING | — |
| text_18 | STRING | — |
| text_19 | STRING | — |
| text_20 | STRING | — |