ComfyUI-StringJoinTools Introduction
ComfyUI-StringJoinTools helps you assemble and inspect text inside a ComfyUI workflow. Its nodes appear in the String Join Tools category and work with STRING values, such as pieces of an image prompt.
You can build a prompt from separate descriptions, choose which descriptions to include, or change part of a prompt while a long generation queue is running. A String Output node lets you check the resulting text before you use it elsewhere in the workflow.
The extension offers three ways to join text:
- Optional String Join combines available inputs without adding gaps for missing or empty ones.
- Toggle String Join lets you choose inputs before you queue a job.
- Runtime Toggle String Join lets you change the choice for jobs that are queued but have not reached the join node yet.
A Runtime Text Input provides editable text for queued jobs, while String Output displays text and passes it through unchanged.
How ComfyUI-StringJoinTools Works
Think of a join node as arranging several prompt fragments in a line. You connect each fragment to a numbered input and choose a separator, the text placed between the fragments that are included.
For example, with portrait, soft lighting, and watercolor, a comma-and-space separator produces portrait, soft lighting, watercolor. If the middle input is empty, Optional String Join produces portrait, watercolor, without an extra comma.
All join variants come with 2, 3, 5, or 10 inputs. If you need more, connect join nodes in stages: join a few groups of fragments, then connect those results to another join node.
The key difference between the toggle variants is when they make their choice:
- Toggle String Join captures its mode and enabled inputs when you queue the prompt. Changing its controls afterward does not change jobs already waiting.
- Runtime Toggle String Join reads the latest live controls when that node executes. A change can therefore affect a waiting job, but not one that has already passed the node.
In both cases, connected text sources still produce their values. A toggle determines whether the join node includes a value; it does not prevent an upstream node from running.
ComfyUI-StringJoinTools Features
Optional String Join
Use Optional String Join when some prompt fragments may be absent, such as a detail supplied by a bypassed upstream node. Its numbered STRING inputs are optional. It ignores unconnected or missing inputs and strings that are exactly empty ("").
It preserves text that is present, including spaces, line breaks, and other characters. For example, an input containing only spaces is not treated as empty. The separator appears only between usable inputs. If none are usable, the output is "".
<img width="582" height="466" alt="Optional String Join node example" src="https://github.com/user-attachments/assets/791980b1-8f51-49f0-ab20-06468d887cac" />
Separators and escape sequences
Optional, Toggle, and Runtime Toggle String Join support a small set of typed shortcuts for separators. These are useful when you want each included fragment on a new line or separated by a tab.
| What you type | Separator used in the output |
|---|---|
\n | A line break (LF) |
\r\n | A Windows-style line break (CRLF) |
\t | A tab |
\\ | One backslash |
\\n | The literal characters \n |
Other sequences, including \u and \x, remain literal text. The shortcuts apply to the separator, not to the contents of your connected strings.
Toggle String Join
Use Toggle String Join when you want to settle on a prompt composition before starting an unattended queue. Enable or disable connected inputs with their buttons or by left-clicking their input rows.
Choose the mode that fits your workflow:
multiple: Each input can be switched on or off independently. Use this to combine several selected descriptions.single: At most one input can be on. Use this to select one alternative, such as one character description. You can also leave all inputs off.
The node displays QUEUE SNAPSHOT to distinguish it from the live runtime variant. Its toggle settings and mode are captured for each job when you queue it.
<img width="540" height="598" alt="Toggle String Join controls and queue snapshot status" src="https://github.com/user-attachments/assets/8bfb37e7-c2f2-4cf4-91d7-d26ff40071ca" />
Runtime Toggle String Join
Use Runtime Toggle String Join when you have queued many jobs but want to keep adjusting which prompt fragments are included. Its subtle amber tint and LIVE status help identify it.
It has the same multiple and single modes as Toggle String Join. In single mode, clicking the active input again turns all inputs off. When the node executes, it joins the currently enabled, non-empty strings. This can be useful when settings such as a LoRA, seed, or character are already queued, but you still want to change the accompanying prompt composition.
A change takes effect only for jobs whose Runtime Toggle String Join has not executed yet. In a typical image workflow, you can think of this as affecting the next image onward. Changes to live controls also invalidate the cached join result so subsequent processing can use the updated text.
The workflow saves the mode, enabled inputs, last selected input, and a persistent state key. The controls also update live state on the ComfyUI server. If that live state is unavailable, a queued job uses its saved values as a fallback. Because live state is shared through the state key, use one active browser tab to control a given workflow.
To keep a record of the prompt used for an image, connect the same Runtime Toggle String Join output to both CLIP Text Encode and your saver's JPEG comment or metadata input.
<img width="561" height="617" alt="Runtime Toggle String Join node with live status" src="https://github.com/user-attachments/assets/f9a37b43-5af4-444c-95fe-f63d6615e15a" />
Runtime Text Input
Runtime Text Input is a multiline text source for jobs that have already been queued. Each job reads the latest text accepted by the ComfyUI server when the node executes. This makes it useful for revising a description during a long run.
Its status tells you whether your edit is ready:
EDITING: You have changed the local text, but it is waiting to be sent.SYNCING: An update is being sent.LIVE: The server has acknowledged the displayed text.SYNC ERROR: The update was not accepted; your visible text remains available so you can retry.
The node preserves empty text, spaces at the beginning or end, line breaks, Unicode characters, and backslashes exactly. It does not send Japanese IME input partway through character conversion. Its character count uses Unicode code points.
When you open a workflow, existing server-side text takes priority. If there is no live state, the workflow's saved text is uploaded and also serves as the fallback captured with a queued prompt. An intentionally live empty string stays empty; it does not revert to queued text. Live server state is held in memory and clears when ComfyUI restarts.
For more deliberate edits, connect Runtime Text Input to Runtime Toggle String Join. Keep that input off while writing, wait until the text shows LIVE, then turn it on. As with runtime toggles, simultaneously controlling workflow copies that share a state key can cause them to overwrite each other's live state.
While the text editor has focus, Ctrl+S or Cmd+S saves the ComfyUI workflow rather than opening the browser's Save Page dialog. Add Shift to use Save As.
<img width="461" height="281" alt="Runtime Text Input editor and status" src="https://github.com/user-attachments/assets/6683d204-6078-461a-bb17-ac75265ea366" />
String Output
Connect String Output wherever you want to check a STRING value. It displays the received text, its character count, and a clear status when the value is an empty string. It returns the same text unchanged, so you can place it between text-producing and text-consuming nodes without altering the prompt.
<img width="356" height="270" alt="String Output displaying text and character count" src="https://github.com/user-attachments/assets/8afa3b1a-3dfe-4a96-8791-b67c7d6fe3f1" />
Troubleshooting ComfyUI-StringJoinTools
I see an extra space or an unexpected line break in the joined prompt.
- Connect the relevant output to String Output to inspect the exact text.
- Check the connected fragments for leading or trailing spaces and line breaks. Join nodes preserve them.
- Check the separator. It is added between included strings and may contribute another space or line break.
A fragment is missing from the result.
- Check that its source is connected and produces text.
- If you are using a toggle variant, check that the input is enabled.
- Remember that an exactly empty string is ignored by a join node. Optional String Join also accepts missing inputs, including those from a bypassed upstream source.
I changed a toggle, but a queued job used the old selection.
Check which variant you used. Toggle String Join takes a snapshot when the job is queued, so this is expected. Use Runtime Toggle String Join when you need a change to affect jobs still waiting to execute that node.
I changed a runtime toggle, but the current image did not change.
The job may already have passed Runtime Toggle String Join. Check a later job in the queue. A live change cannot revise a prompt after that join node has executed.
My Runtime Text Input edit is not appearing in a queued job.
- Look at the editor's status. Wait for
LIVEto confirm that the server has accepted the text. - If it shows
SYNC ERROR, retry the update while the visible text is still available. - Check whether the job had already executed Runtime Text Input before your edit was accepted.
- If you are using Runtime Toggle String Join with that text input, confirm its toggle is on.
Two open workflow tabs seem to interfere with each other.
Live runtime state is shared through a state key on the ComfyUI server. Control a given workflow from one active browser tab, especially when working with copies that may retain the same key.
Frequently asked questions
Do these nodes generate or rewrite prompt text?
No. They combine, select, display, or pass through STRING values. The text itself comes from the inputs you connect or enter.
Can I use more than 10 prompt fragments?
Yes. Join groups of fragments with separate nodes, then join those outputs in another stage.
Does switching a runtime input off stop its source node from running?
No. Queued upstream nodes still produce their STRING values; the toggle controls whether the join includes them.
What happens if every join input is missing, empty, or switched off?
The joined result is an empty string ("").
Does live text survive a ComfyUI restart?
Live server state does not. Runtime Text Input can use text saved in the workflow when no live state exists.
