Skip to content

Basic Syntax Tips for ComfyUI Prompt Writing

This article will briefly introduce some simple requirements and rules for prompt writing in ComfyUI.

Part I: Basic Rules for Prompt Writing

English Writing

Prompts must be written in English as the CLIP model is trained on English datasets.

Phrase Usage

It is recommended to use phrases rather than complete sentences, and separate different phrases with English commas for easy management and weight adjustment.

Comment Support

Comfy UI supports comments, which can be made with a double slash (//) for single-line comments or multi-line comments (/* ... */).

Weight Management

The weight of prompts can be managed by their position in the list, with those at the beginning having higher weight and being more likely to be reflected in the generated image.

Part II: Weight Rules and Syntax for Comfy UI Prompts

Weight Expression

In Comfy UI, prompts can be weighted by adding a weight after the prompt in parentheses, for example, (Prompt: 1.5) means the weight of this phrase is 1.5 times the normal weight. It is recommended to keep it around 0.5 to 1.5.

Quick Weight Adjustment

Users can quickly adjust the weight by selecting the key phrase and using Ctrl plus the up or down arrow keys.

Downweighting Method

In webUI, square brackets ([]) are used to reduce the weight of a phrase, but the effect in Comfy UI may not be as expected.

Random Generation

The method of using curly braces {Prompt|Prompt|Prompt} can achieve random selection for generation, but the generated image will also increase randomness.

3.1 Structured Prompt Writing Rules

  • Subject
  • Features
  • Environment/Background
  • Style
  • Modifiers

4.1 ComfyUI-Custom-Scripts

This plugin provides a variety of enhancements, including prompt assistance, to improve the user experience when using Comfy UI.

For more information, please visit: GitHub - pythongosssss/ComfyUI-Custom-Scripts

4.2 ComfyUI ArtGallery

This plugin provides a visual preview of style prompts, helping users better understand and choose the appropriate prompt style.

For more information, please visit: GitHub - ZHO-ZHO-ZHO/ComfyUI-ArtGallery

Author’s Bilibili video: Prompt Visualization | ComfyUI ArtGallery | Art Gallery | Stable Diffusion

4.3 comfyui-prompt-composer

This tool provides node-based management of prompts, helping users manage and combine prompts more effectively.

For more information, please visit: GitHub - florestefano1975/comfyui-prompt-composer