Nodes/comfyui-prompt-splitter/Prompt Splitter (3 Lines)
ComfyUI Node

Prompt Splitter (3 Lines)

The smallest splitter that actually saves you time

By elgalardi·Created 8 months ago·Updated 8 months ago· 0
Prompt Splitter (3 Lines)
    • line_1
    • line_2
    • line_3
    text

    Wait - do I even need this?

    Honest answer up front: if your workflow only has a positive prompt and a negative prompt, you don't. Two CLIP Text Encode nodes with their own text fields is fine, and adding a custom node for that is ceremony, not help.

    You want Prompt Splitter (3 Lines) the moment you have three text inputs that ought to live in one place - which happens more than you'd think. A positive, a negative, and a third string going to an inpainting branch, a second model in the same graph, or a per-LoRA prompt. Instead of three text widgets scattered around a graph that's already too big to read, you get one multiline box where line 1, line 2 and line 3 each feed a different branch. Edit in one spot, done.

    What it actually is

    It's one small node from the elgalardi/comfyui-prompt-splitter pack: a text-only splitter, one line in, three STRING outputs out. The name is a little dramatic for what it does - there's no API call, no CLIP input, no processing. The entire "pack" is a single Python file with no dependencies and no model downloads, which puts it on the good end of the custom-node trust spectrum. Most of the ecosystem's horror stories come from packs that pull wheels or run scripts at install time; this one just splits text on newlines.

    The one input, the three outputs

    • text - a multiline STRING field. Type or paste your three prompts, one per line.
    • line_1, line_2, line_3 - three STRING outputs.

    Wire each output into the text input of a CLIP Text Encode node (or any node that accepts a string). Because the outputs are plain strings, this works with SD 1.5, SDXL, WanVideo or anything else - prompts are prompts.

    Install

    The pack is tiny and dependency-free, so install is the boring, safe version of the ritual:

    cd ComfyUI/custom_nodes
    git clone https://github.com/elgalardi/comfyui-prompt-splitter
    

    Restart ComfyUI and the node appears under the Text category. ComfyUI Manager can also install it - search "comfyui-prompt-splitter". There's no requirements.txt and nothing else to run.

    Where people get burned

    Two small gotchas, both baked into the split logic:

    1. Blank lines are dropped, not preserved. Each line is stripped and empty lines are skipped before slots get assigned. So "a\n\nb" gives you line_1=a, line_2=b, line_3=`` - not a held-open empty slot 2. Use a placeholder like a dash if you need a visible gap.
    2. Anything past line 3 is silently cut. Write a 4th line and it just doesn't exist. If there's any chance you'll exceed three, grab the 5- or 10-line variant instead - losing text silently is worse than having an empty output.

    Empty slots come back as "", which is harmless; an empty string is a perfectly valid prompt for CLIP Text Encode.

    One more honest note: this is not a dynamic-prompt tool. No wildcards, no __files__, no randomization - that's a different ecosystem (and, confusingly, a different pack called "Prompt Splitter" that does split prompts randomly). This is the boring kind of utility: one box, three wires, fewer text nodes cluttering the canvas. Sometimes boring is exactly what a crowded graph needs.

    CategoryText

    Inputs (1)

    NameTypeDefaultDescription
    textSTRING

    Outputs (3)

    NameTypeDescription
    line_1STRING
    line_2STRING
    line_3STRING