Stable Diffusion

Stable Diffusion Generating Black Images — How to Fix It

Stable Diffusion producing completely black images is one of the most common frustrations for both new and experienced users. This issue typically appears after changing model weights, VAE files, or launch arguments. It affects users running AUTOMATIC1111, ComfyUI, and other frontends on both local machines and cloud GPU environments.

?

Why does this error happen?

Black image output in Stable Diffusion almost always traces back to a VAE (Variational Autoencoder) decode failure or a half-precision (float16) numerical overflow. When the --no-half flag is absent or incorrectly set, certain GPUs — especially those with limited float16 support — produce NaN (not-a-number) tensor values during the decode step, which render as solid black pixels. A mismatch between the model's expected VAE and the one currently loaded can cause the same result. Additionally, an excessively high CFG scale (above 15) can push latent values out of the decodable range, and some xformers builds introduce memory layout conflicts that corrupt the final decode pass.

How to fix it

1

Disable --no-half or Switch to --no-half-vae

If you are launching with the --no-half flag, try removing it first, then relaunch the application. If black images persist, add --no-half-vae instead, which forces the VAE decoder to run in full float32 precision without affecting overall VRAM usage as severely as --no-half alone.

2

Switch to a Known-Good VAE (vae-ft-mse-840000)

Download the vae-ft-mse-840000-ema-pruned.safetensors file and place it in your models/VAE folder. In AUTOMATIC1111, navigate to Settings → Stable Diffusion → SD VAE and select it from the dropdown, then apply and generate again. This VAE is widely tested and resolves black image issues caused by a corrupt or incompatible embedded VAE in certain checkpoint files.

3

Lower Your CFG Scale Below 15

Open your generation settings and confirm the CFG scale (classifier-free guidance) is set to a value between 5 and 12 for most models. Values above 15 can drive latent activations into extreme ranges that the VAE cannot decode correctly, resulting in black or heavily saturated outputs. Reduce the value incrementally and re-run your prompt to verify the fix.

4

Disable xformers and Retest

Remove the --xformers flag from your launch script and restart the server to rule out a memory attention conflict introduced by your installed xformers version. If images render correctly without xformers, try updating xformers via pip install -U xformers before re-enabling it. This is especially relevant after upgrading PyTorch or switching CUDA versions.

Code example

# Try this launch config for black image issues
python launch.py --no-half-vae --xformers

Pro tip

Always pin a specific VAE in your Settings rather than relying on the model's embedded VAE — this single habit eliminates the majority of black image regressions when you switch between checkpoints.

Frequently asked questions

Why do black images only appear on some prompts and not others?
Certain prompt combinations push the latent space into edge-case values that overflow the VAE decoder under half-precision, while simpler prompts stay within a safe range. Switching to --no-half-vae ensures the decode step is stable regardless of latent magnitude.
Can a corrupted model checkpoint cause black images?
Yes — a partially downloaded or corrupted .safetensors or .ckpt file can produce black output alongside other artifacts like color banding. Verify the file hash against the source and re-download if it does not match.
Does this issue affect SDXL models differently than SD 1.5?
SDXL uses a different VAE architecture that is more sensitive to half-precision errors, making black image outputs more common when --no-half-vae is not set. Always use --no-half-vae or the dedicated SDXL VAE (sdxl_vae.safetensors) when working with SDXL checkpoints.
Will running on a cloud GPU fix the black image problem?
Cloud GPUs with higher VRAM allow you to run in full float32 precision without the memory constraints that force half-precision workarounds on consumer cards. Platforms like RunPod let you spin up an A100 or H100 instance where black image issues caused by float16 overflow are significantly reduced.

Run Stable Diffusion on high-VRAM cloud GPUs — no black image headaches

Related Guides