AI Image Model VRAM Calculator (Stable Diffusion & Flux)
Work out the GPU VRAM you need to run Stable Diffusion 1.5, SDXL, SD 3.5, or Flux — at any precision, resolution, and batch size — and see which 6, 8, 12, 16, or 24 GB card fits before you download 10–30 GB of weights. Runs entirely in your browser.
How it works
Every figure is computed in bytes from published component sizes, then shown in GiB (1 GiB = 2³⁰ bytes). Diffusion models have a different memory profile from text LLMs — there is no autoregressive KV cache. Peak memory is the model weights plus an activation/latent peak that grows with resolution, plus a fixed CUDA-context floor.
1. Model weights
Weight memory for each component is params × bytes-per-param, summed over the backbone (UNet for SD 1.5/SDXL, MMDiT for SD 3.5/Flux), the text encoder(s), and the VAE. Bytes per parameter: fp32 = 4, fp16/bf16 = 2, fp8/int8 = 1, and NF4 = 0.5. So SDXL's 2.567 B UNet is ~4.8 GiB at fp16 but ~1.2 GiB at NF4. (Diffusers quantization guide.)
2. What quantization touches
The chosen precision applies to the backbone. Text encoders are kept at fp8 minimum — a T5-XXL rarely runs at 4-bit — and the VAE is kept at fp16 because quantizing it to 4-bit visibly degrades output. That is why quantizing a Flux model to NF4 shrinks the 11.9 B transformer but leaves the VAE and (fp8) text encoders roughly fixed.
3. Activation / latent peak
The activation term is k × (N / 16384) × batch, where N = (H/8) × (W/8) is the latent token count (the VAE downsamples 8×) and kis a per-family coefficient calibrated to the model cards' reference VRAM figures (SD 1.5 ≈ 1.0, SDXL ≈ 2.5, SD 3.5 and Flux ≈ 3.0 GiB at the 1024² reference of N = 16384). This is the term that carries the ± margin, and it is why doubling resolution — quadrupling N — is such a common out-of-memory cause.
4. Optimizations & offload
Attention slicing computes attention in chunks (≈ ½ the activation peak); VAE tiling decodes in tiles to cap the decode spike (a further ≈ ½). Text-encoder CPU offload subtracts the encoder weights from GPU peak by running them on the CPU before denoising. Sequential CPU offload streams one component at a time, so peak VRAM falls to roughly the largest single component — much lower memory, much slower. A flat ~0.8 GiB covers the CUDA context. (Diffusers “Reduce memory usage”.)
5. GPU fit & cross-check
The total is compared against each of the 6/8/12/16/24 GB tiers. If a card is too small, the tool escalates a fixed optimization ladder (slicing → tiling → offload → quantization → sequential offload) and reports the minimum set that fits. As an independent check, each preset is run at a widely-benchmarked reference config and the estimate is confirmed to land inside the model card's published VRAM band — the same idea as cross-checking a tax figure against the regulator's own formula.
Worked examples
Frequently asked questions
Sources & references
- HuggingFace Diffusers — Reduce memory usage (attention slicing, VAE tiling, CPU offload)
- HuggingFace Diffusers — Quantization (bitsandbytes NF4/int8, fp8) overview
- Black Forest Labs — Flux.1 [dev] model card (transformer, T5-XXL, VAE sizes)
- Stability AI — Stable Diffusion XL base 1.0 model card
- Stability AI — Stable Diffusion 3.5 Large model card
Component parameter counts, precision byte-sizes, and optimization effects were last verified against the sources above on 2026-07-09. This tool estimates inference (image generation), not training — LoRA and full fine-tuning need more memory for gradients and optimizer states. Figures target NVIDIA/CUDA VRAM; AMD (ROCm) and Apple silicon (MPS) differ.
Related tools
Comments & feedback
Spotted a bug or want an improvement? Tell us — our team reviews every comment, and good ideas get built. Comments are public and anonymous.
Found a bug, edge case, or want another model preset added?
Email me at [email protected] — most fixes ship within 24 hours.