How to Use ComfyUI: A Complete Step-by-Step Tutorial
From first install to FLUX workflows, ControlNet, and custom node pipelines — everything you need to go from zero to production.
What is ComfyUI? It's a free, open-source node-based interface for Stable Diffusion and FLUX AI models. Instead of hiding the image generation process behind a single "Generate" button, ComfyUI exposes every step as a visual block you can inspect, modify, and rewire — giving you complete control over how your AI outputs are made. Think of it as the Blender of AI image tools: steeper curve than simpler apps, unlimited ceiling.
Download & Install ComfyUI
ComfyUI is free and open-source (GPL-3.0). Run it locally with zero subscription cost, or use the cloud version if you don't have a GPU. Two paths:
One-click installer, auto-updates, works on Windows / Mac / Linux. Recommended for beginners.
Zero setup. Runs in any browser. Pay per GPU-minute. Good for testing before committing to local.
Local desktop install (step by step)
- Go to comfy.org/download and grab the installer for your OS.
- Extract the archive to a short path on an SSD — e.g.
C:\ComfyUI\. Long paths or slow HDDs cause model-loading errors on Windows. - Run the launcher for your hardware:
run_nvidia_gpu.batfor Nvidia GPU on Windows,run_cpu.batfor CPU only (very slow). On Mac: the Desktop app handles this automatically via Metal. - Your browser opens at
http://127.0.0.1:8188— this is your local server. Keep the terminal window open while using ComfyUI.
Nvidia GPU with 6+ GB VRAM — recommended for SDXL. 4 GB works for SD 1.5. FLUX models need 8–12+ GB. Apple Silicon (M1–M4) is supported via Metal. CPU-only works but expect 5–20 minutes per image instead of seconds.
Manual install via GitHub (advanced)
# Clone the official repo
git clone https://github.com/comfy-org/comfyui
cd comfyui
# Install Python dependencies
pip install -r requirements.txt
# Launch with Nvidia GPU
python main.py --cuda-device 0
# Launch CPU-only
python main.py --cpu
# Launch with low VRAM optimizations
python main.py --lowvram
Explore the Interface
ComfyUI loads a dark canvas in your browser. This is your node graph workspace — a visual programming environment where AI processing steps are wired together like a circuit board.
A default text-to-image graph looks roughly like this on the canvas:
- Load Checkpoint (left) outputs MODEL, CLIP, and VAE connections
- CLIP Text Encode nodes (top middle) turn your positive and negative prompts into CONDITIONING
- KSampler (middle) takes MODEL, CONDITIONING, and a LATENT image and runs the diffusion steps (steps, cfg, seed, sampler, scheduler)
- VAE Decode (right) turns the sampled LATENT into a pixel IMAGE
- A Control Panel on the right holds Queue Prompt, Save, Load, and Load Default, plus a queue/running status readout
Double-click canvas → add node · Ctrl+Enter → queue prompt · Ctrl+Z → undo · Ctrl+D → load default workflow · H → fit to canvas · Ctrl+A → select all · Right-click node → bypass / delete / copy
Download Your First AI Model
ComfyUI is the interface — the intelligence comes from a checkpoint model, a 2–12 GB file trained on billions of images. Without one, nothing generates. Here's exactly which model to start with and where to get it.
Which model to start with
Best for: Beginners, fast iteration, older hardware. Standard 512×512 generation. Hugging Face →
Best for: Native 1024×1024 output, superior composition and prompt following. Hugging Face →
Best for: Extremely fast generation (4 steps). Apache 2.0 commercial license. Hugging Face →
Best for: Quantized Dev model — near-identical quality to full precision but fits on standard hardware. Hugging Face →
6 GB VRAM: SDXL 1.0 via Civitai (community fine-tunes are excellent). 8–10 GB: FLUX.1 Dev FP8 — best quality per VRAM dollar. 12+ GB: FLUX.1 Dev full precision.
Where to put the files
# Checkpoint models
ComfyUI/models/checkpoints/your-model.safetensors
# LoRA fine-tunes
ComfyUI/models/loras/your-lora.safetensors
# Upscale models (RealESRGAN etc.)
ComfyUI/models/upscale_models/RealESRGAN_x4plus.pth
# ControlNet models
ComfyUI/models/controlnet/control_v11p_sd15_canny.pth
# VAE (optional, some models need separate VAE)
ComfyUI/models/vae/vae-ft-mse-840000-ema-pruned.safetensors
After placing a file, click Refresh in the control panel. It will appear in the relevant node's dropdown instantly.
Generate Your First Image
Press Ctrl+D to load the default Text-to-Image workflow. You'll get a pre-wired graph — model loader, text encoders, sampler, VAE decoder, image saver. Ready to run.
- Click the Load Checkpoint node dropdown → pick your downloaded
.safetensorsfile. - Positive prompt (top CLIP Text Encode): be specific. "a majestic snow leopard on a mountain peak at golden hour, ultra-detailed fur, photorealistic, dramatic lighting"
- Negative prompt (bottom CLIP Text Encode): "blurry, low quality, deformed, watermark, text, extra limbs, bad anatomy"
- Resolution in Empty Latent Image node: 1024×1024 for SDXL · 512×512 for SD 1.5 · 1024×1024 for FLUX.
- Press Queue Prompt or Ctrl+Enter. A green border sweeps through each node as it processes. Your image appears in the Save Image node output.
Steps (20–30) — more steps = higher quality, slower. CFG Scale (7–12) — how literally the model follows your prompt. High CFG = oversaturated. Sampler: DPM++ 2M Karras is the community default for quality. Seed: fix it while testing so you isolate one variable at a time. Set to -1 for random.
Understand Nodes & Data Flow
This is the most important section. Once you understand data flow, you can build any workflow — not just copy them. Each wire carries one data type. Mismatch types and ComfyUI won't let you connect them — it's a built-in type system.
Standard text-to-image node flow
- Load Checkpoint outputs MODEL, CLIP, and VAE.
- CLIP feeds two CLIP Text Encode nodes — one for the positive prompt, one for the negative prompt — each producing CONDITIONING.
- An Empty Latent Image node produces a blank LATENT at your chosen resolution.
- KSampler takes MODEL, the positive and negative CONDITIONING, and the LATENT, and outputs a sampled LATENT.
- VAE Decode takes the sampled LATENT plus VAE and outputs a pixel IMAGE.
- Save Image takes the IMAGE and writes it to disk.
Click-drag from an output pin (right side) to an input pin (left side) of the same color. ComfyUI enforces type safety — mismatched types won't connect. Right-click any wire to delete it. Right-click a node → Bypass to disable it without breaking the graph.
Add Upscaling — Before & After
Your base generation might be 512px or 1024px. An upscale node takes that output and runs it through a dedicated super-resolution model — producing a 2048–4096px result with recovered fine detail that the base model couldn't render at small scale.
Add the upscaling nodes
- Download
RealESRGAN_x4plus.pthfrom xinntao/Real-ESRGAN releases. Place it inComfyUI/models/upscale_models/. - Double-click canvas → search
Load Upscale Model→ add it. SelectRealESRGAN_x4plusfrom its dropdown. - Double-click canvas → search
Upscale Image (using Model)→ add it. Wire: Load Upscale Model output → Upscale Image (UPSCALE_MODEL pin). - Rewire image flow: VAE Decode output → Upscale Image (IMAGE pin) → Save Image.
- Queue Prompt. Output will be 4× your base resolution with recovered detail.
Upscaling a 1024px → 4096px image needs significant extra VRAM. If you hit an OOM error, try Upscale Latent by (upscales before decoding, more VRAM-efficient) or reduce your base resolution to 768×768 first.
ControlNet — Pose & Depth Control
Without ControlNet, your image composition is entirely up to the model. With it, you feed in a structural guide — a pose skeleton, a depth map, a Canny edge drawing — and the model generates an image that follows that exact structure. This is how AI portrait studios reproduce a client's precise pose across dozens of style variations.
ControlNet types at a glance
| Type | Input | Use case |
|---|---|---|
| OpenPose / DWPose | Photo → skeleton overlay | Match a person's exact body pose |
| Canny Edge | Photo → edge map | Preserve outlines and structural composition |
| Depth Map | Photo → depth estimation | Maintain 3D spatial relationships |
| Scribble / Sketch | Hand-drawn line art | Turn rough sketches into full renders |
| IP-Adapter | Reference image | Match style, face, or composition of a reference photo |
How to set it up
- Via ComfyUI Manager → Install Custom Nodes → search ComfyUI-ControlNet-Aux. Install it and restart.
- Download a ControlNet model matching your base checkpoint. For SDXL:
controlnet-canny-sdxl. For SD 1.5:control_v11p_sd15_openpose. Place inComfyUI/models/controlnet/. - Add a Load Image node → feed your reference photo into a preprocessor node (e.g. DWPose Estimator for poses, Canny for edges).
- Add Load ControlNet Model → select your downloaded model.
- Add Apply ControlNet node. Wire: preprocessor image output → Apply ControlNet IMAGE pin. Wire: Load ControlNet → CONTROL_NET pin. Wire: your positive CONDITIONING → CONDITIONING pin.
- The Apply ControlNet output CONDITIONING replaces your positive conditioning into the KSampler. Adjust strength (0.5–1.0) to control how strongly the structure is enforced.
Canny edge detection is the easiest ControlNet to debug — the edge map is visually obvious. Once you understand the wire routing, swap in DWPose or Depth Anything for more complex conditioning. Official docs with walkthrough: docs.comfy.org/tutorials/controlnet
FLUX Workflow Setup
FLUX is a 12-billion parameter rectified flow transformer from Black Forest Labs — a fundamentally different architecture than Stable Diffusion. It uses a dual CLIP text encoder (T5XXL + CLIP-L), handles long complex prompts far better than SD, and produces photorealistic output with correct anatomy and text rendering. Do not use the standard SD workflow for FLUX — the node graph is different.
FLUX vs. SD node differences
| Component | Stable Diffusion (SDXL) | FLUX |
|---|---|---|
| Model loader | Load Checkpoint | Load Diffusion Model |
| Text encoder | Single CLIP | Dual CLIP: T5XXL + CLIP-L |
| VAE | Bundled in checkpoint | Separate VAE file required |
| Sampler | DPM++ 2M Karras | Euler · scheduler: simple |
| Guidance scale (CFG) | 7–12 typical | 3.5 typical (lower is better) |
| Steps | 20–30 | 20–28 Dev · 4 Schnell |
| Negative prompts | Yes, effective | Ignored / unused in base FLUX |
Set it up in 5 steps
- Download FLUX.1 Dev (
.safetensors) from Hugging Face / black-forest-labs. Place inComfyUI/models/unet/(not checkpoints — FLUX uses a separate unet folder). - Download the FLUX VAE (
ae.safetensors) and both text encoders (t5xxl_fp8_e4m3fn.safetensors+clip_l.safetensors) from the same repo. Place VAE inmodels/vae/and encoders inmodels/clip/. - In ComfyUI, press Ctrl+D → look for a FLUX template in the built-in library, or load one from the Comfy.org workflow browser.
- In the Dual CLIP Loader node, select
t5xxl_fp8_e4m3fnfor clip_name1 andclip_lfor clip_name2. Type:flux. - Write your prompt in the CLIP Text Encode node. FLUX handles long, natural-language prompts well — describe the scene in sentences. No negative prompt needed. Queue and run.
The FLUX.1 Dev FP8 quantized model needs only ~8 GB VRAM vs. 12+ GB for full precision, with near-identical visible quality. It's the practical choice for most GPUs. Add --lowvram to your launch flags for extra headroom.
Save, Share & Explore Templates
Save your workflow
Click Save → exports your full node graph as a .json file. Every node, every setting, every wire. Share this file and anyone can load your exact workflow.
The workflow-in-image trick
Every PNG ComfyUI outputs has the full workflow embedded in its metadata. Drag any ComfyUI-generated PNG onto the canvas and the complete node graph loads instantly — no JSON file needed. This is how the community shares workflows without documentation.
See a stunning ComfyUI image posted online? If the creator didn't strip metadata, drag it onto your canvas. You get their exact model, sampler settings, prompts, and node graph. This is the fastest way to learn advanced techniques.
Built-in template library
Essential Custom Nodes
Install ComfyUI Manager first — it's the package manager for everything else. Without it, installing nodes requires manually cloning GitHub repos.
# From inside your ComfyUI directory:
cd custom_nodes
git clone https://github.com/Comfy-Org/ComfyUI-Manager
# Restart ComfyUI — Manager button appears in UI
| Node Pack | What it does | Priority |
|---|---|---|
| ComfyUI Manager | Package manager — install, update, disable all other nodes from the UI. Non-negotiable first install. | Essential |
| ComfyUI Impact Pack | FaceDetailer — auto-detects faces and re-renders them at high resolution. Fixes deformed faces in seconds. 25%+ of all custom node downloads. | Essential |
| ComfyUI-ControlNet-Aux | Preprocessors for ControlNet: DWPose, Depth Anything V2, Canny, Scribble. Required for Step 7. | High |
| WAS Node Suite | 200+ utility nodes: image ops, file handling, text manipulation, logic nodes. The Swiss army knife of ComfyUI. | High |
| Efficiency Nodes | Compresses the standard workflow into fewer combined nodes. Keeps complex graphs navigable. | Medium |
| SUPIR Upscale | State-of-the-art upscaling — dramatically outperforms RealESRGAN for complex scenes with fine detail. | Medium |
| ComfyUI IPAdapter Plus | Style and face transfer from a reference image. Feed in a photo → generate variations in that style. Extremely powerful for character consistency. | Medium |
What to Build Next
You've completed the foundation. Here's the learning ladder — each level unlocks new categories of output and control.
You can generate, upscale, and work from built-in templates. Build 10+ workflows from scratch using only the default node set before moving up.
Learn to condition generation with reference images, apply multiple LoRAs simultaneously, and use FLUX for photorealistic output. Start with a ControlNet + LoRA combined workflow.
Use IPAdapter for style transfer and character consistency across many images. Build video pipelines. Automate batch generation via the ComfyUI REST API. Explore LoRA training.
Write your own custom nodes in Python. Build multi-stage pipelines (generate → upscale → face fix → video → audio) as a single automated graph. Wire ComfyUI into production apps via the API.
Grab any workflow from comfy.org workflow browser that does something you can't do yet. Load it, break it, fix it, extend it. You'll learn more from debugging someone else's advanced workflow in 2 hours than from tutorials in a week.