Nodes/ComfyUI Prompt Formatter/CLIP Text Encode (Prompt Formatter)
ComfyUI Node

CLIP Text Encode (Prompt Formatter)

Your Stock CLIP Text Encode, With a Prompt-Cleaning Magic Button

By younyokel·Created about a year ago·Updated about a year ago· 6
CLIP Text Encode (Prompt Formatter)
  • clip
  • CONDITIONING
text

Let me save you the most common disappointment up front: this node does not format your prompt automatically. It's ComfyUI's stock CLIP Text Encode with three buttons bolted on the front - 💫 Format Prompt, ✒️ Convert Tags, and ⏪ Undo - and nothing happens until you click one of them. If you came here expecting a node that cleans up whatever you type, that's not it. What it is: a drop-in replacement for CLIP Text Encode that hands you a one-click prompt janitor for the SDXL-lineage world of Danbooru tags and bracket weighting.

What it is

CLIPTextEncodeFormatter ("CLIP Text Encode (Prompt Formatter)") encodes text into CONDITIONING exactly the way the built-in node does. Under the hood it runs clip.tokenize(text) then encode_from_tokens_scheduled, so the conditioning you feed the sampler is byte-for-byte the same kind of output as the core node. Same inputs, same output, same behavior. The whole point of the pack is the buttons, which live in a small JS extension that POSTs your text to two HTTP routes the pack registers on ComfyUI's server.

Click 💫 Format Prompt and it runs a whole cleanup pipeline: NFKC-normalizes weird unicode, strips mismatched brackets, dedupes repeated tags, collapses extra linebreaks and whitespace, aligns commas and brackets, and - if BRACKET2WEIGHT is on (it's the default) - converts stacked brackets into explicit weights. So ((masterpiece)) becomes (masterpiece:1.21). That's the single most useful thing in the pack if you paste prompts from CivitAI or the danbooru tag autocompleters and they come back as ((1girl)), long_hair garbage.

The inputs that matter

  • text (multiline) - your prompt. It's marked dynamicPrompts, so {red|blue} alternation and __wildcard__ files work here like they do on the core node.
  • clip - the CLIP model from your checkpoint loader. If you're on SD 1.5, SDXL, Illustrious, or NoobAI, that's where the tags and weights actually mean something.

Output is one CONDITIONING socket, wired straight into your KSampler or CFG Guider. You might expect an extra text output for the "formatted" string - there isn't one. The cleaned text just replaces the text in the widget, so you see it, and the encode uses whatever is currently in the box.

Where it's a trap

The BRACKET2WEIGHT conversion is the honest catch. Turning ((word)) into (word:1.21) is meaningful on CLIP-based models - those understand weighting. On anything with an LLM text encoder (Flux, Z-Image, basically any 2026 model), prompt weighting is silently discarded and the button is cosmetic at best. This pack is aimed at the Danbooru-tag SDXL crowd. If you run those models, great. If you're on Flux, you're better off with the stock node.

Install

No dependencies, no model downloads, nothing to pip install - the code only imports ComfyUI's own modules. Install it the usual way:

cd ComfyUI/custom_nodes
git clone https://github.com/younyokel/comfyui_prompt_formatter.git

Then restart ComfyUI. Or use ComfyUI Manager's registry search for ComfyUI Prompt Formatter - the pack carries a [tool.comfy] registry block, so Manager finds it.

Troubleshooting

  • Settings didn't change - behavior like BRACKET2WEIGHT and CONV_SPACE_UNDERSCORE lives in settings.json inside the pack folder and is read once at startup. Edit it, then restart. Don't forget it.
  • ✒️ Convert Tags did nothing to a line - by design it skips any line that already contains a comma, parenthesis, or BREAK. Feed it raw underscore tags (1girl long_hair) and it turns them into 1girl, long hair,. It also appends a trailing comma and drops anything matching the blacklist (by default: watermark, signature, dates like 20\d\d, _bubble, onomatopoeia).
  • Undo only goes back one step, and only per node instance. There's no history.
  • Don't expect community help on this one - it's a niche utility with effectively zero reddit footprint. The README is short and the source is the real docs.
Categoryprompt_formatter

Inputs (2)

NameTypeDefaultDescription
textSTRINGThe text to be encoded.
clipCLIPThe CLIP model used for encoding the text.

Outputs (1)

NameTypeDescription
CONDITIONINGCONDITIONINGA conditioning containing the embedded text used to guide the diffusion model.