DP Clean Prompt
Tidy up messy prompt text before it hits the encoder
- clean_text
If you build prompts by gluing fragments together - switch nodes, wildcards, LLM prompt writers, random generators - you end up with junk in the text. Double commas. Trailing commas. A run of blank spaces where an empty fragment used to be. This node takes that mess and hands back a tidy string: redundant separators collapsed, spacing normalized, the formatting a text encoder actually wants.
It's a small utility from DesertPixelAi's Desert-Pixel-Nodes pack, a large collection of quality-of-life tools. It won't change your image on its own - it just stops sloppy prompt assembly from quietly costing you. And it does cost you: a stray , , or a dangling comma is extra tokens the encoder still has to chew on, and on tag-based models that noise can nudge results.
How it works
You feed it a string, it cleans and returns a string. Under the hood it's doing the boring, valuable work of collapsing duplicate commas, trimming leading and trailing separators, and fixing whitespace so your prompt reads as one clean comma-separated list. This matters most right after a concatenation step, where empty inputs leave gaps that shouldn't be there.
Where it fits: put it between your prompt-assembly nodes and your CLIP Text Encode. Anything that builds text programmatically - the pack's own string switches, find-and-replace, wildcard nodes - benefits from a cleanup pass before the text gets encoded or saved into metadata.
The inputs and outputs that matter
There's exactly one of each, which is the point:
input_text- a multiline string. Wire in the assembled prompt, or paste text to clean.
The output is clean_text (a string). Send it to your text encoder, a save-metadata node, or wherever the prompt was headed.
How to install it
- ComfyUI Manager: search "Desert Pixel", install, restart. Nothing to download.
- Manual:
cd ComfyUI/custom_nodes && git clone https://github.com/DesertPixelAi/ComfyUI-Desert-Pixel-Nodes,pip install -r requirements.txtif present, restart.
Find it under the DP category.
Common issues
There's not much to break here. The main thing to understand is scope: this cleans up formatting - separators and spacing - it doesn't rewrite your prompt or judge your word choices. If you were hoping it would prune weak keywords or compress meaning, that's a different job (the pack has a separate compressor node for token trimming). Clean Prompt is punctuation hygiene, full stop.
One tone note that's easy to miss in 2026: on LLM-encoded models (Flux 2, Z-Image, Qwen-based, and friends) your prompt is read as an instruction, not a comma-separated tag bag, so aggressive comma cleanup matters less than it does on SDXL and SD 1.5. It won't hurt anything - it just earns its keep most on the CLIP-era, tag-style models where separator noise actually moves the output. If you're cleaning a prompt-travel schedule string rather than a plain prompt, use the DP_Clean_Prompt_Travel variant instead, which understands that format.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| input_text | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| clean_text | STRING | — |