Prompt Tag Formatter
Squash pasted tags into one clean line — without breaking your weights
- text
You paste a search result or a generator's tag dump into CLIP Text Encode and get a prompt with ragged line breaks, stray commas, and double spaces - and the model reads line breaks as concept boundaries it wasn't meant to. Prompt Tag Formatter exists to fix exactly that: it takes any mess of tags and normalizes it into one comma-space-separated line. tag1 on its own line, tag2,tag3 with no space, a blank line, tag4 - all of it becomes tag1, tag2, tag3, tag4.
That's the whole job, and it's a refreshingly honest one. In a pack otherwise obsessed with turning single prompts into sequences, this node is the front-end cleaner: run pasted tags through it first, then feed the clean line into a Prompt Sequence Text or straight into the encoder.
How it works
The mechanism is where it gets interesting, because a naive "split on every comma" would destroy weighted tags. The node's parser is nesting- and quote-aware: it only splits on a comma or newline when it's not inside balanced (), [], {}, or <> and not inside quotes. So masterpiece, best quality, (detailed eyes:1.2) survives intact - the comma inside the parentheses stays put, and the weight survives. Tags are whitespace-collapsed and stripped of stray leading/trailing commas as they're reassembled.
There's exactly one input and one output, and neither is a list:
text(multiline) - paste your mess here.text(output, single string) - the normalized line, ready for any text input that wants one clean prompt.
It's the only node in the pack that isn't list-shaped; you get one string out, not a sequence. If you want each line to become a separate sequence item, connect this to a Prompt Sequence Text and let it split lines - the formatter's job is the cleanup, not the batching.
Install
Same as every node in this pack: ComfyUI Manager, search comfyui-prompt-sequence, install, restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/Localsmile/comfyui-prompt-sequence
No pip dependencies, no models - it's pure stdlib string handling.
When you'd skip it
Honestly, if your tags are already a single clean comma-space line, this node does nothing for you - pass-through with extra steps. It earns its keep specifically on pasted danbooru/e621-style dumps and multi-line generator output. And the one caveat worth carrying: it's a genuinely small, early pack (single commit, no community footprint), so if your tags rely on unusual weight syntax, glance at the output once before wiring it into a production workflow.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| text | STRING | tag1 tag2,tag3 tag4 | Normalizes line breaks and commas into one comma-space-separated tag line. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| text | STRING | — |