What are wildcards?
Wildcards are a feature that randomly replaces part of a prompt for each queue run, so you can add variation to generated results.
For example, if you write photo of {red|yellow|blue} flower, one of red / yellow / blue will be selected at execution time.
When you churn out a lot of images at once, the same prompt every time gets boring, so use this to mix things up!
Generate images with a random prompt per queue run
ComfyUI text fields (for example, CLIP Text Encode) support wildcard syntax in the {a|b|c} format by default.
-
photo of {red|yellow|blue} flower- One option inside
{}is selected and expanded into the prompt - So you might get
photo of red flowerorphoto of blue flower
- One option inside
Impact-Pack
By default, only the simplest wildcard pattern is available.
If you want to nest wildcards, make some words come up more often than others, or load options from a text file, Impact-Pack is the go-to.
Custom node
ImpactWildcardProcessor / Encode

- Write your wildcard text in the upper field
- The expanded result is shown in the lower field
ImpactWildcardEncode can also switch LoRA entries as wildcards.
Wildcard syntax (Impact-Pack)
dynamic prompts
This is the most basic form: list candidates inside {}.
-
{a|b|c}- One of the
|-separated items is picked
- One of the
-
{a|{1|2|3}|c}- Nesting is supported
-
{5::red|4::green|7::blue|black}- Add
n::in front of each item to bias the probability - Larger numbers are selected more often (probabilities are normalized from the total)
- Add
Load from a text file
You can also keep a word list in a separate file and use it as a wildcard.
- 1. Location
custom_nodes/ComfyUI-Impact-Pack/custom_wildcards
- 2. Format
-
Example:
color.txtred blue yellow
-
- 3. Call it
- Writing
__color__picks one random line from the text file __color__ hairexpands to values likered hair/blue hair/yellow hair
- Writing
-
Subfolders are also supported
- If you place
custom_wildcards/obj/color.txt, call it as__obj/color__
- If you place
$$ (multi-select)
$$ is syntax for selecting multiple candidates and returning them as one string.
-
{n$$red|blue|yellow}- Selects
nitems fromred/blue/yellow - Example:
{2$$red|blue|yellow}->red blue/blue yellow
- Selects
-
{n1-n2$$red|blue|yellow}- Selects between
n1andn2items (count is also random) - Example:
{1-3$$red|blue|yellow}can beredorred blue yellow
- Selects between
-
{2$$ and $$red|blue|yellow}- You can define a delimiter for joining
- Example:
{2$$ and $$red|blue|yellow}->red and yellow/blue and red