# Prompting Guide

import { Image } from 'astro:assets';
import templatesPopover from '../assets/prompt-templates-popover.webp';
import templateMerged from '../assets/prompt-template-merged.webp';

import { Card, CardGrid, Steps } from '@astrojs/starlight/components';

The prompt is your main way of telling a model what to create. This guide starts with writing good prompts, which is all most images need. It then covers the tools that save typing and add variety: prompt templates, dynamic prompts and wildcards. [Advanced Prompt Syntax](/users-guide/image-generation/advanced-prompt-syntax/) covers the syntax for fine control.

For the tools that write or rewrite a prompt for you, **Expand prompt** and **Image to prompt**, and for inserting trigger phrases, see [Prompt Tools](/users-guide/image-generation/prompt-tools/).

## Writing a prompt

Prompting works best when you describe the image clearly, then refine only the parts that matter. Most good prompts cover a few of these:

<CardGrid>
  <Card title="Subject" icon="seti:image">
    Start with the main thing you want to see: a character, object, scene, or action.
  </Card>
  <Card title="Style or Medium" icon="pencil">
    Add the visual language: photograph, watercolor, oil painting, 3D render, anime illustration, and so on.
  </Card>
  <Card title="Lighting and Composition" icon="setting">
    Describe the camera angle, framing, lighting, environment, color palette, or mood that will shape the image.
  </Card>
  <Card title="Detail and Finish" icon="star">
    Add a few high-value details such as fabric texture, shallow depth of field, natural skin texture, or painterly brushwork.
  </Card>
</CardGrid>

A simple pattern that works well is:

`subject, style or medium, lighting or composition, a few important details`

Not every prompt needs every category. Start simple, then add detail only when the model needs more direction.

### Positive and negative prompts

The **positive prompt** describes what you want the model to create. Put the most important idea early and keep the wording concrete.

The **negative prompt** lists what you do not want. Use it to remove recurring problems or unwanted traits, and keep it short and targeted rather than pasting a giant list into every generation. Good negative prompts name specific failure modes: `blurry`, `distorted hands`, `low detail`, `extra limbs`.

Not every model uses a negative prompt. See [Negative prompt](/users-guide/image-generation/generate-panel/#negative-prompt) in the Generate panel guide for which models do.

:::tip[Negative prompts are strong]
  A negative term can suppress nearby concepts too. If you negate something broad like `green` or `moss`, you may also weaken grass, foliage, or other related ideas.
:::

### A practical workflow

<Steps>
  1. **Start with the core image.** Write the clearest version of the image you want before adding stylistic extras.

  2. **Add style and composition.** Once the subject is right, add medium, lens, lighting, mood, background, or framing details.

  3. **Test with a fixed seed.** When you are learning what a prompt change does, set the seed mode to **Fixed** so you can compare results directly.

  4. **Change one thing at a time.** If you add five new terms at once, you will not know which one helped.

  5. **Escalate only when needed.** If the result is close but one element is too weak or too strong, use [attention weighting](/users-guide/image-generation/advanced-prompt-syntax/#attention-weighting). If you want lots of variations, use [dynamic prompts](#dynamic-prompts).
</Steps>

Here is the same idea refined in stages:

```text
portrait of a woman

portrait of a woman, studio photograph, soft key light

portrait of a woman, studio photograph, soft key light, 85mm lens, shallow depth of field, natural skin texture
```

### Write for the model you are using

The same prompt can behave very differently across models.

- Newer models with large language-model text encoders, such as FLUX, Qwen Image, Z-Image and Krea-2, understand full sentences and long, detailed descriptions. Describe the scene as you would to a person, including how things relate to each other and any text that should appear in the image.
- Older models such as SD 1.5 and SDXL use CLIP text encoders trained on short captions, and respond best to short, comma-separated phrases.
- Photo-oriented models respond well to camera, lens, lighting and texture language. Illustration models often respond better to medium, art direction and shape language.
- Specialty models and concepts may expect specific [trigger phrases](/users-guide/image-generation/prompt-tools/#prompt-triggers) from their model card.
- If a prompt works beautifully on one model and poorly on another, that does not always mean the prompt is bad. The model may just speak a different visual language.

### Common mistakes

- Packing too many unrelated ideas into one prompt.
- Using long generic quality-word lists before you know the base prompt works.
- Treating the negative prompt as a trash can for every bad outcome.
- Expecting identical behavior across models, schedulers, and workflows.
- Changing prompt, model, seed, and settings all at once while troubleshooting.

### Example prompts

**Photographic portrait**

```text
editorial portrait of a woman in a charcoal coat, studio photograph, soft key light, subtle rim light, 85mm lens, shallow depth of field, natural skin texture
```

Negative: `blurry, low detail, waxy skin, extra fingers`

**Environment concept art**

```text
ancient stone temple built into a cliffside, fantasy concept art, misty sunrise, towering scale, moss-covered stairs, cinematic atmosphere
```

Negative: `flat lighting, low contrast, muddy details`

**Product-style render**

```text
sleek ceramic teapot on a matte stone surface, product photography, clean studio lighting, soft shadow, high detail, minimal background
```

Negative: `cluttered background, distortion, duplicate objects`

**Stylized illustration**

```text
fox courier crossing a rainy city street, storybook illustration, bold shapes, glowing shop signs, reflective pavement, warm and cool color contrast
```

Negative: `photorealistic, dull colors, low detail`

## Prompt templates

A prompt template is a reusable piece of prompt text, such as a photographic or artistic style, that wraps whatever you type. Apply **Photography (General)** once, and every prompt you write is sent as a photograph without you retyping the style words. Templates are available in the **Generate** panel.

### Applying a template

Click **Templates** in the positive prompt's toolbar. The popover lists the templates available to you in three groups:

* **Your templates** — templates you have created. Only these can be edited or deleted.
* **Shared templates** — templates other users have shared (multi-user installations only).
* **Built-in templates** — the templates that ship with InvokeAI.

<Image src={templatesPopover} alt="The Prompt templates popover listing the built-in Photography templates, each with a preview image and its prompt text." width={420} />

Each row shows the template's preview image, its name and its prompt text. Type in **Search templates** to filter by name or prompt text, and click a template to apply it.

While a template is applied, the **Templates** button shows its name; hover it for the full name. To stop using the template, open the popover and click **Stop using** followed by the template's name, at its bottom.

Applying a template never changes the text in your prompt box. The template is combined with your prompt when you press **Invoke**, so you can switch templates, or remove one, without losing what you wrote.

### How the template and your prompt combine

A template's text usually contains the placeholder `{prompt}`, which marks where your own prompt goes. With the template

```text
{prompt}. photography. f/2.8 macro photo, bokeh, photorealism
```

the prompt `a red fox in the snow` is sent as

```text
a red fox in the snow. photography. f/2.8 macro photo, bokeh, photorealism
```

* Only the first `{prompt}` is replaced. Any further copies stay in the text as written.
* A template without `{prompt}` is added to the end of your prompt, after a space.
* Templates can carry negative text too. It is combined with your negative prompt by the same rules, for models that use a negative prompt.
* A positive prompt that is JSON, such as a [MOSS-Image layout](/users-guide/models/local-models/moss-image/#json-layouts), is sent as written: the template's positive text is not added around it. Its negative text is still combined with your negative prompt.

While a template is applied, an eye button in the prompt toolbar (**Show the merged prompt**) shows the prompt exactly as it will be sent, with the template's words distinguished from yours. The prompt boxes are read-only in this view. Click the text, or the button again (**Back to editing your prompt**), to return to editing.

<Image src={templateMerged} alt="The merged prompt view: the prompt &quot;a red fox in the snow&quot; followed by the Photography (General) template's words, with the template's negative prompt below." width={480} />

### Built-in templates

InvokeAI ships with 18 templates covering common styles:

* **Photography** — General, Studio Lighting, Landscape, Portrait, and Black and White
* **Concept Art** — Fantasy, Sci-Fi, Character and Painterly
* **Architectural Visualization**, **Environment Art**, **Interior Design (Visualization)**, **Product Rendering** and **Vehicles**
* **Sketch**, **Line Art**, **Anime** and **Illustration**

Built-in templates can be applied but not edited. To adapt one, create your own template from its text.

### Creating and editing templates

Click **New template** at the top of the popover. The editor has four fields:

* **Name** — up to 128 characters. Templates you create are saved to your account.
* **Prompt** — the template's positive text. The **`{prompt}`** button next to the field inserts the placeholder.
* **Negative** — optional negative text, which may also contain `{prompt}`.
* **Preview image** — an optional thumbnail for the list. Pick an image from the gallery, upload a file or drag one in.

Click **Save** to store the template. To change or remove one of your templates later, use the pencil and trash buttons on its row. Deleting a template cannot be undone. If you delete, or someone else deletes, a template you are currently using, it keeps shaping your prompt until you stop using it. The **Templates** button dims its name, and the popover notes that it was deleted.

To reuse the prompt of an image you like, right-click it in the Gallery or Preview and choose **Use as Prompt Template**. The New template editor opens with the image's positive and negative prompts filled in. Replace the part that describes the subject with `{prompt}`, name the template and save it.

### Importing and exporting templates

The popover's **Import** and **Export** buttons move templates in and out as files. In a multi-user installation they are available to administrators only.

* **Import** reads a `.csv` or `.json` file. A CSV file needs the columns `name`, `prompt` and `negative_prompt`; a JSON file is a list of objects with the same keys. Every template needs a name. Imported templates become your own templates.
* **Export** downloads every user-created template as `prompt_templates.csv`, with the same three columns. Built-in templates are not included.

Preview images are not part of either file.

On a multi-user installation, templates you create are private to your account. Templates that other users have shared appear under **Shared templates**, where you can apply them but not change them.

### Templates and image metadata

An image's metadata records the prompt that was actually used, with the template already combined into it. It does not record which template was applied. When you recall the prompts from an image, you get that combined text, and any template you currently have applied is removed so that the style is not applied twice.

## Dynamic prompts

Dynamic prompts expand a single prompt into many variations. Write the parts you want to vary as a list of alternatives, and one press of **Invoke** generates an image for each variation. They are useful for brainstorming, exploring styles and subjects, and testing a model without rewriting the same prompt by hand.

Dynamic prompts work in the **Generate** panel, on the Canvas and in the [**Video** panel](/users-guide/video-generation/introduction/#prompt). Only the positive prompt is expanded; the negative prompt is used as written for every variation.

In the **Video** panel each variation queues a full video, so **Max prompts** starts at 10 there instead of 100. Projects saved before Video supported dynamic prompts open with them off, so their prompts keep running as typed; switch on **Use dynamic prompts** to expand them.

### Basic syntax

Put alternatives inside braces and separate them with `|`:

```text
a {red|green|blue} balloon
```

This expands into three prompts: `a red balloon`, `a green balloon` and `a blue balloon`. Several groups in one prompt multiply:

```text
a {red|green} {balloon|kite}
```

gives `a red balloon`, `a red kite`, `a green balloon` and `a green kite`. Groups can also be nested: `a {cat|{small|large} dog}` gives `a cat`, `a small dog` and `a large dog`. More syntax is described under [Advanced dynamic prompt syntax](/users-guide/image-generation/advanced-prompt-syntax/#advanced-dynamic-prompt-syntax).

### Previewing and generating

Click **Dynamic** in the prompt toolbar to open the Dynamic prompts popover. When the prompt contains dynamic syntax, the button shows how many prompts it expands into. **Use dynamic prompts** at the top of the popover switches expansion off for the project, so the prompt is used exactly as typed; **Dynamic** then reads **Off**.

The **Preview** tab lists the expanded prompts, numbered and highlighted, and shows the total as *prompts × iterations → generations*. The Invoke button's tooltip shows the same count. Only the first 200 prompts are listed; the rest are summarized as *and N more*.

Click a prompt in the list to replace your prompt with that one variation, for example to refine it on its own. If a template is applied, it is folded into the chosen prompt and the template itself is removed, since its words are now part of your prompt.

If the prompt cannot be expanded, for example because a brace is not closed or a wildcard has no values, the Preview tab and a note under the prompt show the error, and Invoke is blocked until you fix it or turn dynamic prompts off. When the server could not be reached, the note offers **Retry**.

<Steps>

1. **Write the prompt** with the parts you want to vary in braces.

2. **Open Dynamic** and check the Preview list. Make sure the combinations make sense before you generate a large batch.

3. **Set the mode and the number of prompts** (see below).

4. **Press Invoke.** Each expanded prompt is generated once per iteration, so 6 prompts with **Iterations** set to 2 give 12 images.

</Steps>

### All combinations or a random sample

The **Mode** menu in the Preview tab sets how prompts are chosen:

<CardGrid>
  <Card title="All combinations" icon="list-format">
    Lists every combination in order, up to **Max prompts**. This is the default, and the best choice when you want to compare every option.
  </Card>
  <Card title="Random sample" icon="random">
    Draws **Number of prompts** variations at random, honoring any weights. The same prompt can be drawn more than once. Click **Shuffle the sample** to draw a new sample.
  </Card>
</CardGrid>

The number of prompts can be set from 1 to 10,000 and is 100 by default. Combinations grow quickly, so this limit keeps an innocent-looking prompt from queuing thousands of images: `a {red|green|blue} balloon in {morning mist|golden hour|rain}` already has nine combinations.

:::tip[Start small]
  Preview a handful of variations first. Once they look useful, raise the limit or the number of iterations for a larger batch.
:::

### Seeds

By default, every variation within one iteration shares the same seed. Because only the prompt changes between the images, this makes it easy to see what each option does.

Turn on **New seed for every generation** to give each image its own seed instead, for the widest variety. When the panel's **Seed mode** is **Fixed**, every image uses the same seed and this switch is unavailable.

### Dynamic prompts and other features

* **Prompt templates.** Expansion runs on your prompt after the [template](#prompt-templates) has been applied, so a template can contain dynamic syntax too.
* **JSON prompts.** A prompt that is a JSON object or array, also inside a Markdown code fence such as ```` ```json ````, is sent as written for every model. Dynamic syntax and [wildcards](#wildcards) in it are not expanded, and the **Dynamic** badge stays off.
* **Image metadata.** Each image records the expanded prompt that produced it and its own seed. The original dynamic prompt and the dynamic prompt settings are not recorded.
* **Workflows.** The workflow editor has a **Dynamic Prompt** node, and batch generators for random and combinatorial expansion.

## Wildcards

A wildcard is a named list of values that you can use in any prompt. Write the name between double underscores, and it behaves like a [dynamic prompt](#dynamic-prompts) group of all its values:

```text
a __colors__ balloon
```

With a `colors` wildcard containing `red`, `green` and `blue`, this is the same as `a {red|green|blue} balloon`. Wildcards save retyping long lists and keep them consistent between prompts.

Values can contain dynamic syntax, including other wildcards. Names can be nested with `/`, such as `animals/dogs`, and `__animals/*__` combines every wildcard under `animals`.

### Managing wildcards

Wildcards are managed on the **Wildcards** tab of the **Dynamic** popover.

* **New wildcard** opens the editor. Give the wildcard a **Name** (letters, numbers, underscores and hyphens, up to 128 characters) and its **Values**, one per line. Blank lines are ignored, and `#` starts a comment.
* Click a wildcard to insert it at the cursor (**Insert into the prompt**). You can also type `__` in the prompt, or use the **+** [prompt trigger](/users-guide/image-generation/prompt-tools/#prompt-triggers) menu.
* Use the pencil and trash buttons on a wildcard to edit or delete it.
* **Search wildcards** finds wildcards by name or value.
* To delete several wildcards at once, tick the checkbox beside each one, or use **Select all** above the list to select every wildcard the search shows (selections from earlier searches are kept). Then choose **Delete** and confirm once. The **×** button clears the selection.

Wildcards belong to your account. On a multi-user installation, each user has their own set.

### Importing and exporting wildcards

**Import** reads wildcards from files you already have, such as collections downloaded for other tools:

* **From files…** imports one or more files. A `.txt` file (or a file without an extension) becomes one wildcard named after the file, with one value per line.
* **From a folder…** imports every wildcard file in a folder. Subfolders become part of the name, so `animals/dogs.txt` becomes `animals/dogs`.
* A `.yaml`, `.yml` or `.json` file can hold many wildcards. Nested keys become the name, joined with `/`, and each list becomes a wildcard's values.

If some wildcards already exist in your library, or cannot be imported, the **Import wildcards** dialog lists them. For each existing name you can **Skip** it, **Replace** it, or **Keep both**, which imports the new one under a numbered name.

**Export** downloads all your wildcards as `wildcards.yaml` (**As YAML**) or `wildcards.json` (**As JSON**), in the same nested format.

## Advanced syntax

For finer control, [Advanced Prompt Syntax](/users-guide/image-generation/advanced-prompt-syntax/) covers [attention weighting](/users-guide/image-generation/advanced-prompt-syntax/#attention-weighting) — making parts of a prompt count for more or less, and blending prompts, on SD 1.5, SD 2.x and SDXL — and the [advanced dynamic prompt syntax](/users-guide/image-generation/advanced-prompt-syntax/#advanced-dynamic-prompt-syntax) for choosing several options, weighting options, variables and comments.