Skip to content

Wildcards in Prompts

Wildcards are placeholders in prompt text. Each placeholder is replaced with a random value from a list, which adds variety to generated prompts.

  • SD.Next supports standard file-based wildcards in prompts.
  • Wildcard support is enabled by default. You can disable it in Settings -> Extra Networks if you want to use a third-party extension instead of SD.Next built-in support.
  • Wildcards folder is set in Settings -> System Paths. Default path: models\wildcards.

How It Works

TL;DR: the string __abc__ in a prompt is matched to a file named abc.txt in the wildcards folder.

The prompt syntax for wildcards is:

a woman wearing a __color__ dress

In the wildcards folder, create file color.txt and add multiple choices with one choice per line:

red
green
blue

Inline Choices

In addition to standard wildcards, SD.Next also supports curly braces syntax for inline choices:

woman with {blonde|brunette|red-head|purple highlights} hair

You can combine file-based wildcards and inline choices in the same prompt, including nested forms:

woman with {blonde|__color__} hair woman with {blonde|brunette|auburn|{purple|pink|green}} hair

Wildcards in curly braces can have weights, too:

woman with {blonde:0.6|__color__} hair woman with {blonde:.4:|brunette:.4|{purple:.2|pink:.4|cyan}} hair woman with {blonde:8:|brunette:4|red-head:2|purple highlights:1} hair

The allowed weight range is [0:1]. If a weight is above 1, the whole range is normalized.

Tips

  • Wildcards can be used in both positive and negative prompts
  • Prompt can have any number of wildcards

    a woman wearing a __color__ dress and a __shape__ hat

  • Wildcards can be nested
    A line inside a wildcard file can reference another wildcard.
  • Supports filename-only and path-based wildcards with full subfolder support
    If wildcard is referenced as __color__, it looks for:
  • file color.txt in any subfolders
    If wildcard is referenced as __color/__, it looks for:
  • folder color with any wildcard files inside it
    If wildcard is referenced as __nsp/color__, it looks for:
  • color.txt only in nsp folder inside wildcards folder
  • Wildcard files can use one choice per line, or multiple choices per line separated by |

Validation

Wildcard matches and replacements will be logged in the standard log with debug level:

DEBUG Wildcards apply: wildcard="color" choice="Yellow" file="models/wildcards/my-variations/color.txt" choices=930