induwara.lk
induwara.lkAI · GPU memory

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.

By Induwara AshinsanaUpdated Jul 9, 2026
Image model VRAM estimate
Model cards + Diffusers docs
Popular setups
Memory optimizations
Total estimated VRAM
9.76 GiB
Plan for 8.29 GiB11.2 GiB (±15%)
Suggested settings

Fits the 6 GB (RTX 2060 / 3050) (3.97 GiB) with: attention slicing, VAE tiling, text-encoder CPU offload, FP8 quantization.

Memory breakdown

ComponentMemoryShare
UNet / DiT weights4.78 GiB49%
Text encoder(s)1.52 GiB15.6%
VAE (kept at fp16)0.15 GiB1.58%
Activation / latent peak2.50 GiB25.62%
CUDA / framework overhead0.80 GiB8.2%
Total9.76 GiB100%

Cross-check: at its reference config this model estimates 9.76 GiB, inside the published 811 GiB band. SDXL fp16, 1024² — commonly cited 8–10 GB.

Which GPU fits

GPUEst. VRAMVerdict
6 GB (RTX 2060 / 3050)3.97 GiBWith attention slicing + VAE tiling + text-encoder CPU offload + FP8 quantization
8 GB (RTX 3060 Ti / 4060)7.88 GiBWith attention slicing + VAE tiling
12 GB (RTX 3060 / 4070)9.76 GiBFits as-is
16 GB (RTX 4060 Ti / 4080)9.76 GiBFits as-is
24 GB (RTX 3090 / 4090)9.76 GiBFits as-is

Verdicts use your model, precision, resolution, and batch size — but ignore the optimization toggles above, so each row shows the minimum a card needs. ✅ fits as-is · ⚠️ fits with the listed optimizations · ❌ won't fit even fully optimized.

Component parameter counts come from the official HuggingFace model cards; the optimization effects follow the Diffusers memory guide and quantization guide. Weight math is exact; the activation term is benchmark-calibrated, so real usage varies ±10–20% with the sampler, kernels, and framework. Figures target NVIDIA/CUDA VRAM.

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

SDXL at fp16, 1024×1024, no optimizations

  1. UNet: 2.567B × 2 bytes = 4.78 GiB
  2. Text encoders (CLIP-L + bigG): 0.817B × 2 = 1.52 GiB
  3. VAE (fp16): 0.083B × 2 = 0.15 GiB → weights 6.46 GiB
  4. Activation: 2.5 × (16384/16384) × 1 = 2.50 GiB; overhead 0.80 GiB
  5. Total ≈ 9.76 GiB → ✅ 12 GB card; ⚠️ 8 GB with attention slicing + VAE tiling

Flux.1 [dev] at 1024×1024 — precision sweep

  1. bf16: transformer 22.2 + T5/CLIP 9.1 + VAE 0.16 + act 3.0 + oh 0.8 ≈ 35.2 GiB → ❌ 24 GB
  2. fp8: transformer 11.1 + encoders 4.5 + VAE 0.16 + 3.0 + 0.8 ≈ 19.6 GiB → ✅ 24 GB
  3. NF4: transformer 5.5 + encoders 4.5 (fp8) + VAE 0.16 + 3.0 + 0.8 ≈ 14.0 GiB → ✅ 16 GB
  4. NF4 + text-encoder CPU offload: 14.0 − 4.5 ≈ 9.5 GiB → ✅ 12 GB card

Edge case — fit SDXL on an 8 GB card

  1. Start: SDXL fp16 1024² ≈ 9.76 GiB → too big for 8 GB
  2. Attention slicing: activation 2.50 → 1.25 GiB
  3. VAE tiling: activation 1.25 → 0.625 GiB (decode spike capped)
  4. Weights 6.46 + activation 0.63 + overhead 0.80 = 7.88 GiB → ✅ 8 GB (RTX 3060 Ti)

Frequently asked questions

Sources & references

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

Rate this tool
Be the first to rate

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.