Washed-out colors, a black image, or an out-of-memory error at the very last node: in ComfyUI, the VAE is usually the cause. It’s the small model that turns latents into pixels and back, and every workflow depends on it.
The good news is that VAE problems are easy to fix once you know which VAE goes with which model and what the decode and encode nodes do.
This guide explains the VAE in ComfyUI from the source code. It covers baked vs separate VAEs, which VAE file each model family needs, where to put them, the tiled nodes and their settings, the fp16/fp32 launch flags, TAESD previews, and fixes for the most common VAE errors.
- What it does: VAE Encode turns an image into a latent; VAE Decode turns a latent back into an image. Sampling happens in between.
- Baked VAE: most checkpoints include one, so the Load Checkpoint VAE output is fine. Use Load VAE only when a model ships without one, or to swap in a better one.
- Folder:
ComfyUI/models/vae/. Preview decoders (TAESD) go inmodels/vae_approx/. - Match the family: an SD 1.5 VAE on SDXL, or an SDXL VAE on Flux, gives garbage or a shape error.
- Out of memory: ComfyUI already retries with tiled decoding automatically. For control, use VAE Decode (Tiled) (tile_size 512, overlap 64 by default).
New to ComfyUI? Start with my ComfyUI guide, which covers install, nodes and workflows in one place.
What the VAE Does
Diffusion models don’t work on pixels. They work on a latent, a compressed version of the image. For SD 1.5 and SDXL, the latent is 8 times smaller in each direction, so a 1024×1024 image becomes a 128×128 latent with 4 channels. Newer models use more channels (Flux and SD3 use 16).
The VAE (variational autoencoder) is the translator:
- VAE Encode: image to latent. Used for img2img, inpainting and upscaling passes.
- VAE Decode: latent to image. Used at the end of every workflow.
That’s why your width and height must be multiples of 8 on most models. The latent can’t have half a pixel.
Baked VAE vs Load VAE
A checkpoint (.safetensors) often contains three things: the diffusion model, the text encoder(s) and a VAE. Load Checkpoint outputs all three, so the simplest workflow connects its VAE output straight to VAE Decode. That’s the “baked” VAE.
Use a separate Load VAE node when:
- The model is split into parts, as with Flux, Qwen-Image, Wan and most new models loaded through Load Diffusion Model. These never include a VAE.
- The checkpoint’s baked VAE is poor or missing. Some old SD 1.5 merges had washed-out VAEs.
- You want a fixed version, such as the SDXL fp16-fix VAE, to avoid black images in half precision.
Connect the Load VAE output to every VAE node in the workflow (encode and decode), not just one.
Which VAE for Which Model
A VAE only works with its own latent format. Here are the usual pairings. Exact file names vary by download source, so check the model card or the official ComfyUI template.
| Model family | VAE to use | Common file name |
|---|---|---|
| SD 1.5 and fine-tunes | SD 1.5 VAE (often baked) | vae-ft-mse-840000-ema-pruned.safetensors |
| SDXL, Pony, Illustrious | SDXL VAE (often baked) | sdxl_vae.safetensors or the fp16-fix version |
| SD 3 / 3.5 | SD3 VAE (16-channel) | Baked into the all-in-one checkpoints |
| Flux.1 and Flux-based models | Flux VAE (16-channel) | ae.safetensors |
| Qwen-Image family | Qwen-Image VAE | qwen_image_vae.safetensors |
| Wan 2.1 / Wan 2.2 14B | Wan 2.1 VAE | wan_2.1_vae.safetensors |
| Wan 2.2 5B | Wan 2.2 VAE | wan2.2_vae.safetensors |
Flux-based fine-tunes generally reuse the Flux VAE. Models like Z-Image or newer releases may reuse an existing VAE, so always check which one the official template loads. My ComfyUI model folders cheat sheet lists where every file type goes.
Where to put VAE files
ComfyUI/models/vae/ ← full VAE files (.safetensors)
ComfyUI/models/vae_approx/ ← TAESD preview decoders
Press R or refresh the browser after adding files. To share a VAE folder with A1111 or Forge, use extra_model_paths.yaml.
The VAE Nodes
| Node | What it does | Key inputs |
|---|---|---|
| Load VAE | Loads a VAE file | vae_name (also lists TAESD files and pixel_space) |
| VAE Decode | Latent to image | samples, vae |
| VAE Encode | Image to latent | pixels, vae |
| VAE Decode (Tiled) | Decodes in tiles to save memory | tile_size 512, overlap 64, temporal_size 64, temporal_overlap 8 |
| VAE Encode (Tiled) | Encodes in tiles | tile_size 512, overlap 64 |
| VAE Encode (for Inpainting) | Encodes an image with a mask, blanking the masked area | pixels, vae, mask, grow_mask_by (default 6) |
VAE Encode (for Inpainting) is meant for dedicated inpainting models and needs denoise 1.0. For normal models, use plain VAE Encode plus Set Latent Noise Mask instead. My ComfyUI inpainting guide explains the difference.
Tiled Decode and Encode Settings
Decoding is often the most memory-hungry step in a workflow, especially at 2048 px and above or with video. Tiled decoding splits the latent into overlapping pieces, decodes each, and blends them.
ComfyUI already falls back to tiling
In ComfyUI’s code, the regular VAE Decode tries a normal decode first. If it runs out of memory, the console prints “Ran out of memory when regular VAE decoding, retrying with tiled VAE decoding” and it switches to tiles automatically.
For VAEs with a reliable memory estimate, it skips straight to tiling when the estimate is bigger than your free VRAM.
So you only need the Tiled node when you want to control the tile size, or when even the automatic tiling runs out of memory.
Settings
| Input | Default | Advice |
|---|---|---|
| tile_size | 512 (pixels) | Lower to 256-384 on 6-8 GB cards. Larger tiles mean fewer seams but more memory. |
| overlap | 64 | Raise to 96-128 if you see faint grid lines. It’s capped at a quarter of the tile size. |
| temporal_size | 64 (frames) | Video VAEs only. Lower to 16-32 if a long video won’t decode. |
| temporal_overlap | 8 | Video VAEs only. Smooths the joins between frame chunks. |
For video workflows, tiled decoding is often the difference between a finished clip and a crash. My ComfyUI out of memory fix covers the rest of the memory settings.
fp16, bf16, fp32 and CPU VAE Flags
ComfyUI picks the VAE precision automatically for your GPU. You can override it with launch flags (only one of the first three at a time):
| Flag | What it does | When to use it |
|---|---|---|
--fp32-vae |
Runs the VAE in full precision | Black or NaN images on older GPUs; maximum accuracy |
--fp16-vae |
Runs the VAE in fp16 | Saves memory, but ComfyUI’s own help text warns it “might cause black images” |
--bf16-vae |
Runs the VAE in bf16 | Good balance on RTX 30-series and newer |
--cpu-vae |
Runs the VAE on the CPU | Very low VRAM. Much slower. |
On the portable build, add flags to the end of the line in run_nvidia_gpu.bat. My ComfyUI command line arguments guide lists the rest.
TAESD: Fast Previews
TAESD (“tiny autoencoder”) models are tiny approximate VAEs. ComfyUI uses them to show live previews in the KSampler while it samples, and they can also be loaded as a fast, low-quality VAE.
- Download the encoder and decoder files for your model family (for example
taesdxl_decoderandtaesdxl_encoderfor SDXL, ortaef1for Flux) from the TAESD project. - Put them in
ComfyUI/models/vae_approx/. - Launch with
--preview-method taesd, or pick the preview method in the settings. The default isnone; other options areautoandlatent2rgb.
When both encoder and decoder of a TAESD family are present, the Load VAE list also shows it (for example taesdxl). It’s handy for quick drafts, but use the full VAE for final images.
Troubleshooting
Black image
Usually a half-precision VAE overflowing. Try --fp32-vae or --bf16-vae, or swap in the SDXL fp16-fix VAE. My ComfyUI black image fix covers the other causes.
Washed-out, grey or desaturated colors
The baked VAE is poor, or you’re using the wrong family’s VAE. Load the correct VAE with Load VAE and connect it to all VAE nodes.
Noise, colored static or a garbled image
The VAE doesn’t match the model. An SD 1.5 VAE on an SDXL latent, or the Wan 2.1 VAE with the Wan 2.2 5B model, decodes nonsense. Check the model’s template.
Size mismatch or “expected 16 channels” errors
A 4-channel VAE (SD 1.5/SDXL) is being used with a 16-channel latent (Flux, SD3), or the other way round. See the shape mismatch fix.
Faint grid lines in large images
Tiled decoding seams. Raise overlap to 96-128 or use a bigger tile size.
Out of memory at VAE Decode
Use VAE Decode (Tiled) with a smaller tile size, decode fewer images at once, or close other GPU apps.
FAQ
Do I need a separate VAE in ComfyUI?
Not for most SD 1.5 and SDXL checkpoints, which include one. Split models like Flux, Qwen-Image and Wan always need a separate VAE.
Where do VAE files go in ComfyUI?
In ComfyUI/models/vae/. TAESD preview files go in models/vae_approx/.
Can I use an SDXL VAE with SD 1.5?
No. They use different latent spaces, so the image comes out garbled.
Is VAE Decode (Tiled) lower quality?
Barely. With enough overlap the result is almost identical. Small differences can appear at tile edges.
Why is VAE decoding so slow?
It may be running on the CPU (--cpu-vae or low-VRAM mode), in fp32, or in tiles. Check your launch flags and the console.
Does the VAE affect image quality?
Yes. A bad VAE can soften detail, shift colors or add artifacts, especially on faces and text.
What is pixel_space in the Load VAE list?
A pass-through option for models that work directly on pixels rather than latents. Ordinary image and video models don’t use it.
Sources
- ComfyUI source: nodes.py (VAELoader, VAE Decode/Encode, Tiled nodes and defaults, VAE Encode for Inpainting)
- ComfyUI source: comfy/sd.py (automatic tiled fallback on out-of-memory)
- ComfyUI source: cli_args.py (VAE precision flags and preview methods)




