Nodes/ComfyUI/KSampler
ComfyUI Node Runs on cloud

KSampler

The one node that's in every workflow you've ever downloaded

By Comfy-Org·Created 4 years ago·Updated about 22 hours ago· 128,525
KSampler
  • model
  • positive
  • negative
  • latent_image
  • LATENT
seed0
steps20
cfg8.0
sampler_name
scheduler
denoise1.00

This is the node that actually does the drawing. Everything before it - loaders, CLIP encode, empty latents - is just getting ingredients ready, and everything after it (VAE Decode, upscalers) is cleanup. KSampler takes a noisy latent and walks it down to a clean one, guided by your prompt, one step at a time. If you've downloaded one ComfyUI workflow in your life, it had one of these in it.

It ships with ComfyUI core (nodes.py), so there's nothing to install - it's in every default install, and it's usually the first sampler people learn because it's the whole sampling pipeline in a single node.

How it works

Under the hood, each step is two predictions. The model runs once conditioned on your positive prompt and once on the negative, and the difference between them gets amplified by cfg - that's classifier-free guidance, and it's why CFG roughly doubles the compute. Then a sampler decides how to remove noise each step, and a scheduler decides how much to remove.

Two things the community learned the hard way, so you don't have to:

  • Sampler and scheduler are a pair, not two independent tastes. SD 1.5 and SDXL still love dpmpp_2m + karras at 20–30 steps. But anything flow-matching - Flux, Z-Image, Klein, Anima - wants an Euler-family sampler on a conservative schedule like normal or beta. Karras on a flow-matching model doesn't just underperform, it fails outright: the straight trajectory has nothing for an aggressive schedule to correct.
  • cfg is not "higher is more obedient." The sweet spot is architecture-specific. 5–9 on SD 1.5/SDXL, 4–6 on Pony/Illustrious, and roughly 1 on any distilled model. Turbo and Lightning checkpoints run at CFG 1 by design - guidance is baked into the weights - so cranking the dial doubles your render time and burns the image.

The inputs that matter

  • positive / negative - your prompt and what you want to steer away from. Note the negative does nothing at CFG 1 on most samplers; the pass behind it isn't even computed.
  • seed - sets the initial noise. Same seed + same settings = same image. For A/B testing one variable, lock the seed; the troubleshooting KB says it plainly: change one thing at a time or you can't diagnose anything.
  • steps - more steps isn't always better. Converging samplers (Euler, DPM++ 2M) settle; beyond a point extra steps just cost time.
  • denoise - the img2img dial. At 1.0 it starts from pure noise; lower it and it preserves the structure of your input latent. 0.4–0.6 is the classic "keep the composition, change the style" range.
  • sampler_name / scheduler - see above. When a model card recommends a pair, trust it before any habit.

The output is a single LATENT, which you feed into a VAE Decode to get pixels.

Where people get burned

The two classics: images that come out "deep fried" (CFG too high - lower it before touching anything else), and black or garbled output (usually a VAE/latent channel mismatch upstream, not the sampler's fault). The newer one is dragging SDXL-era defaults onto a 2026 model and wondering why it looks awful. Check what architecture your checkpoint is built on, not when it shipped - a 2026 Illustrious merge is still DDPM-style, and an 8-step distilled model still wants CFG 1.

If you need to cut a sampling run into stages - hires fix, partial denoise, run some steps on a clean prompt then swap - that's what KSampler (Advanced) is for. If you want to swap pieces in and out of the pipeline individually, the custom sampler graph is the modern way.

Categorymodel/sampling

Inputs (10)

NameTypeDefaultDescription
modelMODELThe model used for denoising the input latent.
seedINT00–18446744073709550000The random seed used for creating the noise.
stepsINT201–10000The number of steps used in the denoising process.
cfgFLOAT8.00–100The Classifier-Free Guidance scale balances creativity and adherence to the prompt. Higher values result in images more closely matching the prompt however too high values will negatively impact quality.
sampler_nameCOMBOThe algorithm used when sampling, this can affect the quality, speed, and style of the generated output.
schedulerCOMBOThe scheduler controls how noise is gradually removed to form the image.
positiveCONDITIONINGThe conditioning describing the attributes you want to include in the image.
negativeCONDITIONINGThe conditioning describing the attributes you want to exclude from the image.
latent_imageLATENTThe latent image to denoise.
denoiseFLOAT1.000–1The amount of denoising applied, lower values will maintain the structure of the initial image allowing for image to image sampling.

Outputs (1)

NameTypeDescription
LATENTLATENTThe denoised latent.