Stable Diffusion
Stable Diffusion Wildcards: Syntax + Copy-Paste Wildcard Files
How wildcards work in Stable Diffusion (Dynamic Prompts, ComfyUI, SwarmUI), the full __wildcard__ and {a|b} syntax, and ready-made wildcard files to copy.
By Eren Koray. Checked against the sources listed at the end on . 9 min.
On this page
A wildcard is a placeholder such as __hair_color__ that is replaced by a random line from a text file each time you generate. Combined with {red|blue|green} choices, one prompt can produce hundreds of different images. This page covers the syntax, where the files go in each tool, and ready-made wildcard files you can copy.
Quick start (AUTOMATIC1111 + Dynamic Prompts)
- Install Dynamic Prompts from the web UI's Extensions tab.
- Create a text file in
extensions/sd-dynamic-prompts/wildcards/, for examplehair_color.txt, with one option per line. - Use the file name between double underscores in your prompt:
portrait of a woman with __hair_color__ hair, {soft window light|golden hour|neon lights}, 85mm photo
- Set Batch count to 8 and generate. Each image gets a different hair color and lighting.
Syntax cheat sheet
| Syntax | What it does | Example |
|---|---|---|
{a|b|c} | Picks one option | {cat|dog|fox} |
{0.5::a|0.2::b} | Weighted pick (relative, missing = 1) | {3::day|1::night} |
{2$$a|b|c} | Picks 2 different options | {2$$red|blue|green} → red, blue |
{2$$ and $$a|b|c} | Custom separator | → red and blue |
{1-3$$a|b|c|d} | Picks 1 to 3 options | {1-2$$hat|scarf|gloves} |
__name__ | Random line from name.txt | __hair_color__ |
__folder/name__ | File in a subfolder | __clothes/winter__ |
__colors*__ | All files starting with colors | colors-warm.txt + colors-cold.txt |
__artists/**__ | Every file under a folder, at any depth | |
{2$$__name__} | 2 different lines from one file | {2$$__accessories__} |
${v=!{a|b}} then ${v} | Pick once, reuse the same value | Keep one season across the prompt |
__file(var=x)__ | Pass a value into a template file | __outfit(season=winter)__ |
{@a|b} / __@name__ | Cycle through options in order | Keep two lists in sync |
# | Comment (whole line in .txt files) | # warm colors |
Values in {2$$...} are picked without replacement, so you do not get the same option twice. If you ask for more options than exist, you get all of them.
Copy-paste wildcard files
Save each block as a .txt file with the name shown, one option per line. Lines starting with # are comments.
hair_color.txt
# hair_color.txt
black
dark brown
chestnut
auburn
copper red
strawberry blonde
golden blonde
platinum blonde
silver
pastel pink
lavender
teal
hairstyle.txt
# hairstyle.txt
long straight hair
long wavy hair
curly hair
short bob
pixie cut
high ponytail
twin braids
messy bun
side-swept bangs
buzz cut
afro
undercut
outfit.txt
# outfit.txt
oversized knit sweater and jeans
black leather jacket and white t-shirt
flowing summer dress
tailored grey suit
denim overalls
hooded raincoat
traditional kimono
cyberpunk techwear jacket
medieval wool cloak
lab coat
school uniform
astronaut suit
location.txt
# location.txt
busy Tokyo street at night
quiet library with tall shelves
misty pine forest
rooftop garden in the city
desert canyon at sunset
cozy cafe interior
snowy mountain village
abandoned greenhouse
beach boardwalk
neon-lit subway station
old European market square
spaceship corridor
lighting.txt
# lighting.txt
soft window light
golden hour sunlight
overcast diffused light
dramatic rim light
neon lights
candlelight
studio softbox lighting
harsh midday sun
moonlight
backlit silhouette
foggy morning light
volumetric light rays
shot.txt
# shot.txt
close-up portrait
medium shot
full body shot
wide establishing shot
low angle shot
high angle shot
over-the-shoulder shot
dutch angle
aerial view
macro shot
mood.txt
# mood.txt
calm and peaceful
joyful
melancholic
mysterious
tense
dreamy
nostalgic
playful
lonely
hopeful
art_medium.txt
# art_medium.txt
oil painting
watercolor
ink sketch
charcoal drawing
gouache illustration
digital painting
pencil drawing
3d render
cel-shaded anime
linocut print
pastel drawing
photograph on 35mm film
weather.txt
# weather.txt
light rain
heavy rain
snowfall
thick fog
clear blue sky
storm clouds
after the rain, wet streets
autumn wind with falling leaves
heat haze
drizzle at dusk
Putting them together
__shot__ of a person with __hair_color__ __hairstyle__, wearing __outfit__, __location__, __weather__, __lighting__, __mood__, __art_medium__
With 10 shots, 12 hair colors, 12 hairstyles, 12 outfits, 12 locations, 10 weathers, 12 lightings, 10 moods and 12 media, this single prompt has almost three billion combinations (12⁶ × 10³), so random mode is the way to explore it.
One YAML file instead of many
Dynamic Prompts also reads YAML. Nested keys become folders, and YAML is the way to put weights inside a wildcard file:
Use it as __character/hair__, __character/eyes__ and __character/weighted_season__.
Keep one random choice consistent
By default, every __name__ is picked separately, so __season__ ... __season__ can give two different seasons. Use an immediate variable to pick once:
${season=!{spring|summer|autumn|winter}}
a ${season} landscape, trees in ${season} colors, ${season} sky
Without the !, the variable is re-evaluated each time it is used. That is handy for repeating a whole description with different results:
${person={blond|redhead|brunette}, {green|blue|brown} eyes}
a ${person} man and a ${person} woman sitting at a cafe table
Random vs combinatorial
- Random (default): each image gets a random pick. Good for exploring.
- Combinatorial generation (checkbox in the extension): produces every possible combination once. Good for "one image per style in this list". Use the Max generations slider so you do not start thousands of images by accident.
- Fixed seed: uses the same seed for every image, so only the wildcard changes. Use it to compare the effect of one list, such as lighting:
a lighthouse on a cliff at dusk, __lighting__
A1111's Batch count slider stops at 100 by default; the README explains how to raise it in ui-config.json for large combinatorial runs.
Ready-made collections
Dynamic Prompts ships three collections you can copy into your wildcards folder from its Wildcard Manager tab:
- jumbo: a very large set covering aesthetics, appearance, artists, medium, style and time.
- parrotzone: a smaller, more manageable set.
- devilkkw: character building, clothes, gestures and food.
Wildcards in ComfyUI and SwarmUI
ComfyUI supports {day|night} directly in the text box: the front end picks one option each time you queue the prompt. To type real curly brackets, escape them as \{ and \}. It also accepts // and /* */ comments. For __wildcard__ files, the Dynamic Prompts author publishes a separate ComfyUI node pack (comfyui-dynamicprompts).
a {red|blue|black} sports car on a {mountain road|city street|race track}, {sunset|night|rain}
SwarmUI has its own syntax:
| SwarmUI | Same as |
|---|---|
<random:red, blue, purple> | {red|blue|purple} |
<random:red|blue|purple> | Use | when options contain commas |
<random:1-5> | A random number from 1 to 5 |
<wildcard:animals> or <wc:animals> | __animals__ |
<wildcard[1-3]:animals> | 1 to 3 picks from the file |
SwarmUI wildcard files live in Data/Wildcards (you can drop in text files from other UIs) or can be edited in the Wildcards tab. Its randoms follow the main seed, so with a fixed seed they do not change unless you set Wildcard Seed.
Troubleshooting
| Problem | Fix |
|---|---|
__name__ stays as text in the prompt | The extension is not active, or the file is not in the wildcards folder |
| "No values found for wildcard some/wildcard" | The file must be at extensions/sd-dynamic-prompts/wildcards/some/wildcard.txt; give the full path from the wildcards folder |
| Every image looks the same | Fixed seed is on and the prompt has no wildcard, or (SwarmUI) Wildcard Seed is set |
{a|b} clashes with another extension | Change the variant brackets in Settings → Dynamic Prompts |
| Errors after updating the web UI | Update both the extension and the dynamicprompts library; the README gives the pip command |
Related guides
To place different prompts in different parts of the image, combine wildcards with Regional Prompter. For weights such as (word:1.2) inside wildcard lines, see the prompt weighting guide. For SDXL prompt structure, see the SDXL prompt guide.
Build your prompt
The prompt generator builds a base prompt from subject, style and lighting choices. Swap any part for a __wildcard__ to turn it into a template. It runs in your browser and does not generate images.
Primary sources
Build your own prompt
Describe your image and copy it formatted for Midjourney, Stable Diffusion, Flux, ChatGPT or Gemini.
Open the prompt generatorMore guides
- Stable Diffusion Low VRAM Guide: Flags & Settings That Work
Stable Diffusion
- SDXL Prompt Guide: Formula, Examples & Settings (2026)
Stable Diffusion
- Best Stable Diffusion Extensions for A1111 & Forge (2026)
Stable Diffusion
- Regional Prompter Guide: BREAK, ADDCOL, ADDROW + Examples
Stable Diffusion