Free tool · runs in your browser

VRAM calculator for local LLMs

Pick a model, a quant and a context length. We add up the weights, the KV cache and the runtime overhead, then show which GPUs and Macs can hold it. Every formula is on this page, and every result is an estimate.

This page has Amazon affiliate links and Runpod and Vast.ai referral links. As an Amazon Associate, we earn from qualifying purchases. You won't pay more. Disclosure.

Your model

Q4_K_M is the usual sweet spot. Lower is smaller with more quality loss.
How much text the model keeps in view. The KV cache grows with it.
Quantizing the cache saves memory at long context. Needs flash attention in llama.cpp.
Only decides whether a too-big model can spill into RAM.

Estimate for Llama 3.1 8B Instruct, Q4_K_M, 8,192 tokens of context

Estimated memory needed6.3 GBestimate, not a measurement
  • Weights 4.5 GB 8.03B params × 4.85 bits per weight ÷ 8
  • KV cache 1.0 GB 131,072 bytes per token × 8,192 tokens
  • Runtime overhead 0.8 GB compute buffers, 0.5 GB base

Smallest common GPU memory size that fits with room to spare: 8 GB.

38 GPUs fit fully1 with partial offload0 won't fit
GPUVRAMResult
GeForce RTX 2060 6GB6 GBPartial offload85% of weights on GPU, rest in system RAM
GeForce RTX 5060 Ti 8GB8 GBFits on GPU
GeForce RTX 50608 GBFits on GPU
GeForce RTX 4060 Ti 8GB8 GBFits on GPU
GeForce RTX 40608 GBFits on GPU
GeForce RTX 30708 GBFits on GPU
GeForce RTX 3060 Ti8 GBFits on GPU
Radeon RX 76008 GBFits on GPU
GeForce RTX 3080 10GB10 GBFits on GPU
GeForce RTX 2080 Ti11 GBFits on GPU
GeForce RTX 507012 GBFits on GPU
GeForce RTX 4070 Ti12 GBFits on GPU
GeForce RTX 4070 Super12 GBFits on GPU
GeForce RTX 407012 GBFits on GPU
GeForce RTX 3080 Ti12 GBFits on GPU
GeForce RTX 3060 12GB12 GBFits on GPU
Radeon RX 7700 XT12 GBFits on GPU
Radeon RX 6700 XT12 GBFits on GPU
Arc B58012 GBFits on GPU
GeForce RTX 508016 GBFits on GPU
GeForce RTX 5070 Ti16 GBFits on GPU
GeForce RTX 5060 Ti 16GB16 GBFits on GPU
GeForce RTX 4080 Super16 GBFits on GPU
GeForce RTX 408016 GBFits on GPU
GeForce RTX 4070 Ti Super16 GBFits on GPU
GeForce RTX 4060 Ti 16GB16 GBFits on GPU
Radeon RX 9070 XT16 GBFits on GPU
Radeon RX 907016 GBFits on GPU
Radeon RX 9060 XT 16GB16 GBFits on GPU
Radeon RX 7900 GRE16 GBFits on GPU
Radeon RX 7800 XT16 GBFits on GPU
Radeon RX 6800 XT16 GBFits on GPU
Arc A770 16GB16 GBFits on GPU
Radeon RX 7900 XT20 GBFits on GPU
GeForce RTX 409024 GBFits on GPU
GeForce RTX 3090 Ti24 GBFits on GPU
GeForce RTX 309024 GBFits on GPU
Radeon RX 7900 XTX24 GBFits on GPU
GeForce RTX 509032 GBFits on GPU

Macs and unified-memory PCs

DeviceMemory optionsSmallest option that fits
Apple M18 / 16 GBFits on GPUfrom 16 GB
Apple M1 Pro16 / 32 GBFits on GPUfrom 16 GB
Apple M1 Max32 / 64 GBFits on GPUfrom 32 GB
Apple M1 Ultra64 / 128 GBFits on GPUfrom 64 GB
Apple M28 / 16 / 24 GBFits on GPUfrom 16 GB
Apple M2 Pro16 / 32 GBFits on GPUfrom 16 GB
Apple M2 Max32 / 64 / 96 GBFits on GPUfrom 32 GB
Apple M2 Ultra64 / 128 / 192 GBFits on GPUfrom 64 GB
Apple M38 / 16 / 24 GBFits on GPUfrom 16 GB
Apple M3 Pro18 / 36 GBFits on GPUfrom 18 GB
Apple M3 Max (40-core GPU)48 / 64 / 128 GBFits on GPUfrom 48 GB
Apple M3 Ultra96 / 256 / 512 GBFits on GPUfrom 96 GB
Apple M416 / 24 / 32 GBFits on GPUfrom 16 GB
Apple M4 Pro24 / 48 / 64 GBFits on GPUfrom 24 GB
Apple M4 Max (16-core CPU)48 / 64 / 128 GBFits on GPUfrom 48 GB
Apple M516 / 24 / 32 GBFits on GPUfrom 16 GB
AMD Ryzen AI Max+ 39564 / 128 GBFits on GPUfrom 64 GB
NVIDIA DGX Spark128 GBFits on GPUfrom 128 GB

The GPU can use about 2/3 of a Mac's memory (3/4 at 64 GB and up), so a 16 GB Mac holds less than a 16 GB graphics card. "Fits" means total ≤ 94% of usable memory; "tight" means it fits with less headroom. Estimates only. How we estimate

How the calculator works

Running a model on a GPU needs three blocks of memory. Sizes below use GB to mean 1,024³ bytes (GiB), the unit GPU memory is sold in.

total = weights + KV cache + runtime overhead

1. Weights

weights (bytes) = parameters × bits per weight ÷ 8

"Bits per weight" is the average for the whole GGUF file, higher than the headline number because llama.cpp keeps some tensors at higher precision. We use these values (the same ones the Will it run? tool and the methodology page use):

QuantBits per weight8B model70B modelQuality
FP161614.9 GB130 GBunquantized
Q8_08.57.9 GB69.3 GBnear-lossless
Q6_K6.566.1 GB53.5 GBvery close to full quality
Q5_K_M5.695.3 GB46.4 GBsmall quality loss
Q4_K_M4.854.5 GB39.5 GBthe usual sweet spot
Q3_K_M3.913.6 GB31.9 GBnoticeable quality loss

Models released in a non-GGUF official format (DeepSeek-R1 in FP8, gpt-oss in MXFP4) use the official checkpoint size instead. For a mixture-of-experts model, weights use the total parameter count, because every expert must be in memory.

2. KV cache

KV cache (bytes) = 2 × layers × KV heads × head dimension × context tokens × bytes per value

The 2 is for the key and value tensors. The layer count, KV head count and head dimension come from each model's config.json on Hugging Face. Worked example, Llama 3.1 8B (32 layers, 8 KV heads, head dimension 128, FP16 cache):

2 × 32 × 8 × 128 × 2 bytes = 131,072 bytes per token
131,072 × 8,192 tokens = 1,073,741,824 bytes ≈ 1.0 GB

Bytes per value for the cache type:

KV cache typeBytes per valueSize vs FP16
FP16 (default)2.000100.0%
Q8_01.06353.1%
Q4_00.56328.1%

Q8_0 stores 32 values in 34 bytes (32 int8 plus a 2-byte scale), Q4_0 in 18 bytes (16 bytes of 4-bit values plus the scale). See context length and VRAM for how fast the cache grows.

3. Runtime overhead

overhead = 0.5 GB + vocabulary × 512 × 4 bytes + hidden size × 512 × 32 bytes

This covers compute buffers for a 512-token batch, and comes to 0.6 GB–1.1 GB for the models we track. Real overhead depends on the runtime and batch settings, which is one reason to treat results as estimates.

Models with sliding-window or linear attention

Some models do not cache every token in every layer. Gemma, gpt-oss and Llama 4 mix full-attention layers with sliding-window layers that keep only the last 128, 512, 1,024 or 8,192 tokens (it varies by model), and some Qwen models mix in linear-attention layers with a small fixed-size state. For these the calculator splits the cache the same way: full layers × context tokens, plus sliding layers × min(context, window), plus any fixed state. That is why their KV cache stays small at long context. Models affected: Llama 4 Scout 17B-16E Instruct, Qwen3.6 27B, Qwen3.6 35B-A3B, Gemma 3 4B, Gemma 3 12B, Gemma 3 27B, Gemma 4 E4B, Gemma 4 12B, Gemma 4 26B-A4B, Gemma 4 31B, gpt-oss-20b, gpt-oss-120b.

What "fits" means

  • Fits on GPU: total ≤ 94% of the card's VRAM.
  • Tight fit: total is above that but still within the card's VRAM. Close other GPU programs.
  • Partial offload: weights spill over into system RAM, as long as the KV cache and overhead stay in VRAM and your RAM (minus 6 GB for the OS) holds the rest. Works, but much slower.
  • Won't fit: not enough VRAM and RAM combined at this quant and context.

Memory needed by model and quant at 8K context

The same formulas, precomputed for every model we track, with an FP16 KV cache and 8,192 tokens. Click a model for its full page, or open it in the calculator to change the context.

ModelParamsFP16Q8_0Q6_KQ5_K_MQ4_K_MQ3_K_MOfficial
Llama 3.2 1B Instruct calculator1.24B3.3 GB2.3 GB2.0 GB1.8 GB1.7 GB1.6 GB—
Llama 3.2 3B Instruct calculator3.21B7.6 GB4.8 GB4.1 GB3.8 GB3.5 GB3.1 GB—
Phi-4 Mini 3.8B Instruct calculator3.84B9.1 GB5.7 GB4.9 GB4.5 GB4.1 GB3.7 GB—
Qwen3 4B calculator4.02B9.4 GB5.9 GB5.0 GB4.6 GB4.2 GB3.8 GB—
Gemma 3 4B calculator4.3B9.3 GB5.6 GB4.6 GB4.2 GB3.7 GB3.3 GB—
Mistral 7B Instruct v0.3 calculator7.25B15.1 GB8.8 GB7.2 GB6.4 GB5.7 GB4.9 GB—
Qwen2.5 Coder 7B Instruct calculator7.62B15.5 GB8.8 GB7.1 GB6.3 GB5.6 GB4.8 GB—
Gemma 4 E4B calculator8.0B16.1 GB9.1 GB7.3 GB6.5 GB5.7 GB4.8 GB—
Llama 3.1 8B Instruct calculator8.03B16.8 GB9.8 GB7.9 GB7.1 GB6.3 GB5.5 GB—
DeepSeek R1 Distill Llama 8B calculator8.03B16.8 GB9.8 GB7.9 GB7.1 GB6.3 GB5.5 GB—
Qwen3 8B calculator8.19B17.2 GB10.1 GB8.2 GB7.4 GB6.6 GB5.7 GB—
Gemma 4 12B calculator12B23.8 GB13.3 GB10.6 GB9.4 GB8.2 GB6.9 GB—
Gemma 3 12B calculator12.2B24.6 GB13.9 GB11.2 GB9.9 GB8.8 GB7.4 GB—
Mistral Nemo 12B Instruct calculator12.3B24.9 GB14.2 GB11.4 GB10.2 GB9.0 GB7.7 GB—
Phi-4 14B calculator14.7B29.6 GB16.8 GB13.5 GB12.0 GB10.6 GB9.0 GB—
Qwen3 14B calculator14.8B29.6 GB16.7 GB13.4 GB11.9 GB10.5 GB8.8 GB—
DeepSeek R1 Distill Qwen 14B calculator14.8B29.9 GB17.0 GB13.6 GB12.2 GB10.7 GB9.1 GB—
gpt-oss-20b calculator20.9B3.6B active——————13.9 GB
Devstral Small 24B calculator23.6B46.0 GB25.4 GB20.1 GB17.7 GB15.4 GB12.8 GB—
Mistral Small 3.2 24B Instruct calculator24B46.8 GB25.8 GB20.4 GB18.0 GB15.6 GB13.0 GB—
Gemma 4 26B-A4B calculator25.8B4.0B active49.5 GB26.9 GB21.1 GB18.5 GB16.0 GB13.1 GB—
Gemma 3 27B calculator27.4B53.2 GB29.3 GB23.1 GB20.3 GB17.6 GB14.6 GB—
Qwen3.6 27B calculator27.8B53.4 GB29.2 GB22.9 GB20.1 GB17.4 GB14.3 GB—
Qwen3 30B-A3B calculator30.5B3.3B active58.4 GB31.8 GB24.9 GB21.8 GB18.8 GB15.5 GB—
Gemma 4 31B calculator31.3B60.7 GB33.4 GB26.4 GB23.2 GB20.1 GB16.7 GB—
Qwen3 32B calculator32.8B63.9 GB35.3 GB27.9 GB24.6 GB21.4 GB17.8 GB—
Qwen2.5 Coder 32B Instruct calculator32.8B63.9 GB35.3 GB27.9 GB24.6 GB21.4 GB17.8 GB—
DeepSeek R1 Distill Qwen 32B calculator32.8B63.9 GB35.3 GB27.9 GB24.6 GB21.4 GB17.8 GB—
Qwen3.6 35B-A3B calculator36B3.0B active68.2 GB36.8 GB28.7 GB25.0 GB21.5 GB17.6 GB—
Llama 3.3 70B Instruct calculator70.5B135 GB73.2 GB57.2 GB50.1 GB43.2 GB35.5 GB—
Llama 4 Scout 17B-16E Instruct calculator109B17B active205 GB110 GB85.4 GB74.4 GB63.8 GB51.9 GB—
gpt-oss-120b calculator117B5.1B active——————62.0 GB
DeepSeek R1 (671B) calculator684B37B active1276 GB679 GB524 GB455 GB388 GB313 GB643 GB

Architecture numbers used for each model

Read from each model's config.json on Hugging Face (data refreshed with refresh-models). "KV per token" is the FP16 cache for one token across all layers; sliding-window layers stop growing after their window.

ModelAttention layoutKV per token (FP16)Max context
Llama 3.2 1B Instruct16 full-attention layers, 8 KV heads (grouped-query)32,768 B128K
Llama 3.2 3B Instruct28 full-attention layers, 8 KV heads (grouped-query)114,688 B128K
Phi-4 Mini 3.8B Instruct32 full-attention layers, 8 KV heads (grouped-query)131,072 B128K
Qwen3 4B36 full-attention layers, 8 KV heads (grouped-query)147,456 B40K
Gemma 3 4B5 full-attention, 29 sliding-window (1024 tokens) layers139,264 B128K
Mistral 7B Instruct v0.332 full-attention layers, 8 KV heads (grouped-query)131,072 B32K
Qwen2.5 Coder 7B Instruct28 full-attention layers, 4 KV heads (grouped-query)57,344 B32K
Gemma 4 E4B4 full-attention, 20 sliding-window (512 tokens) layers; last 18 layers reuse earlier caches57,344 B128K
Llama 3.1 8B Instruct32 full-attention layers, 8 KV heads (grouped-query)131,072 B128K
DeepSeek R1 Distill Llama 8B32 full-attention layers, 8 KV heads (grouped-query)131,072 B128K
Qwen3 8B36 full-attention layers, 8 KV heads (grouped-query)147,456 B40K
Gemma 4 12B8 full-attention, 40 sliding-window (1024 tokens) layers344,064 B256K
Gemma 3 12B8 full-attention, 40 sliding-window (1024 tokens) layers393,216 B128K
Mistral Nemo 12B Instruct40 full-attention layers, 8 KV heads (grouped-query)163,840 B128K
Phi-4 14B40 full-attention layers, 10 KV heads (grouped-query)204,800 B16K
Qwen3 14B40 full-attention layers, 8 KV heads (grouped-query)163,840 B40K
DeepSeek R1 Distill Qwen 14B48 full-attention layers, 8 KV heads (grouped-query)196,608 B128K
gpt-oss-20b12 full-attention, 12 sliding-window (128 tokens) layers49,152 B128K
Devstral Small 24B40 full-attention layers, 8 KV heads (grouped-query)163,840 B128K
Mistral Small 3.2 24B Instruct40 full-attention layers, 8 KV heads (grouped-query)163,840 B128K
Gemma 4 26B-A4B5 full-attention, 25 sliding-window (1024 tokens) layers225,280 B256K
Gemma 3 27B10 full-attention, 52 sliding-window (1024 tokens) layers507,904 B128K
Qwen3.6 27B16 full-attention, 48 linear-attention layers65,536 B256K
Qwen3 30B-A3B48 full-attention layers, 4 KV heads (grouped-query)98,304 B40K
Gemma 4 31B10 full-attention, 50 sliding-window (1024 tokens) layers901,120 B256K
Qwen3 32B64 full-attention layers, 8 KV heads (grouped-query)262,144 B40K
Qwen2.5 Coder 32B Instruct64 full-attention layers, 8 KV heads (grouped-query)262,144 B32K
DeepSeek R1 Distill Qwen 32B64 full-attention layers, 8 KV heads (grouped-query)262,144 B128K
Qwen3.6 35B-A3B10 full-attention, 30 linear-attention layers20,480 B256K
Llama 3.3 70B Instruct80 full-attention layers, 8 KV heads (grouped-query)327,680 B128K
Llama 4 Scout 17B-16E Instruct12 full-attention, 36 sliding-window (8192 tokens) layers196,608 B10240K
gpt-oss-120b18 full-attention, 18 sliding-window (128 tokens) layers73,728 B128K
DeepSeek R1 (671B)Multi-head latent attention (MLA)70,272 B160K

What this calculator does not tell you

  • Speed. This tool only estimates memory. For speed estimates see the Will it run? tool, and read our note on how those estimates work.
  • Multi-GPU and image models. Splitting a model over two cards adds some overhead per card, and image or video models have different memory rules.
  • Your exact setup. Browsers, games and the desktop use VRAM too. Leave a gigabyte or two spare.

Next steps

Frequently asked questions

How much VRAM do I need to run an LLM locally?

Add up three things: the model weights (parameters × bits per weight ÷ 8), the KV cache (which grows with context length) and about 0.5 GB or more of runtime overhead. For Llama 3.1 8B Instruct at Q4_K_M with 8,192 tokens of context that is about 6.3 GB, These are estimates, not measurements.

What is the VRAM formula for LLM weights?

weights in bytes = parameters × bits per weight ÷ 8. A 8B model at Q4_K_M, which averages about 4.85 bits per weight once the tensors llama.cpp keeps at higher precision are counted, takes about 4.5 GB. At FP16 (16 bits) the same model needs about 15.0 GB.

How do I calculate KV cache size?

KV cache bytes = 2 × layers × KV heads × head dimension × context tokens × bytes per value. The 2 is for the key and value tensors. Llama 3.1 8B has 32 layers, 8 KV heads and a head dimension of 128, so at FP16 it needs 131,072 bytes per token, or 1.0 GB at 8,192 tokens.

Does quantizing the KV cache save VRAM?

Yes. In llama.cpp a Q8_0 cache is about 53% the size of FP16 and a Q4_0 cache about 28%. Quantizing the V cache needs flash attention enabled, and a smaller cache can cost some quality, most noticeably at Q4_0. It matters most at long context, where the KV cache can rival the weights.

Can a model run if it does not fit entirely in VRAM?

Yes, with partial offload: some layers stay in system RAM and run on the CPU. The calculator marks a GPU "Partial offload" when the KV cache and overhead fit in VRAM and the remaining weights fit in your system RAM (minus 6 GB kept for the operating system). It works, but generation slows down a lot, because system RAM is several times slower than VRAM.

Why does a mixture-of-experts model need so much memory for its size?

All experts have to be loaded even though only a few are used per token. A model like Qwen3 30B-A3B has 3.3B active parameters but needs memory for all 30.5B. The active count affects speed, not how much memory you need, so the calculator uses total parameters for weights.

How accurate is this VRAM calculator?

It is an estimate from published formulas and real model configs, not a measurement. Real use varies with the runtime (llama.cpp, Ollama, LM Studio), batch size, GPU driver and whether other programs use VRAM, and we have not checked the totals against measured VRAM on every card. We say "fits" at 94% of the card's memory or less, to leave room for the desktop and other apps.