AI & LLM development
Local LLM Memory Calculator
Pick a model, a context length, and the memory you have. The calculator estimates the weights, the context cache, and the runtime overhead, then tells you which quantizations fit in your GPU and what happens when they do not. It runs entirely in your browser, and nothing you type is sent anywhere.
This is the companion to my guide, Run LLMs Locally: Ollama, LM Studio, and llama.cpp Compared. The numbers are estimates, so treat them as a way to rule models in or out before you download several gigabytes.
- Runs in your browser
- Nothing is sent anywhere
- Measured file sizes
- Checked December 4, 2026
Will it fit?
Best fit for your setup
- Weights
- Context cache
- Overhead
- Your video memory
| Quantization | Result | Memory | Max context |
|---|
Max context is the longest context that fits entirely in video memory at that quantization. Quality usually drops as you go below four bits per weight, so the best choice is normally the highest quantization that still fits with room for your context. Partial offload works, but speed falls steeply as more layers move to system memory. In my speed tests on four 8 GB cards, a model about 1 GB too big ran 4 to 8 times slower than one that fit. If you already know the exact file size, enter it under Advanced assumptions to get a row for that file. Memory is shown in GiB. Multiply by 1.074 for decimal GB.
Data checked December 4, 2026. See the sources at the bottom of this page.
How the numbers are worked out
- Weights: parameters in billions times bits per weight, divided by 8 bits per byte.
- Cache: 2 (keys and values) times layers times KV heads times head size times bytes per value, per token, times your context length and parallel requests. For hybrid and sliding-window models, this is worked out per layer type: layers with linear attention add nothing, and sliding-window layers stop growing once the context passes their window.
- Fit: weights plus cache plus overhead against your video memory. If it is too big, layers move to the GPU one at a time until memory runs out, and the rest must fit in system memory.
- Units: GiB means binary gigabytes, the unit GPU tools report. One GiB is about 1.07 GB, so these figures run a few percent below the decimal table in my guide.
What this does not include
- Speed. Memory tells you whether a model fits, not how fast it generates. My Local LLM Speed Estimator covers that.
- Runtimes that keep a bigger cache than the per-layer-type count assumes. The fixed state of linear-attention layers is small, and the 1 GiB of overhead covers it.
- Compressed attention such as DeepSeek's Multi-head Latent Attention, which needs far less cache. The config.json reader warns about it.
- Vision and audio encoders, which add their own weights. Parameter counts here are text-only, and the config.json reader warns when it sees an encoder.
- The exact way each runtime splits layers, and how well your GPU driver handles it.
- Mixture-of-experts offload tricks. This tool treats every model as a plain stack of layers, and it counts all the experts in the memory total. Only the speed estimator uses the smaller active size.
Model data and sources
Layers, KV heads, head size, and layer types were read from each model's config.json on Hugging Face. I read the newer models on December 4, 2026, and the older ones on November 20, 2026. The Llama figures come from the unsloth mirror, because Meta's repository is gated. Parameter counts come from the models' safetensors headers, with vision and audio encoders subtracted. For Gemma 4 E2B and E4B they include the per-layer embedding tables, and the "active" column shows the effective size that Google lists. Active parameters for the mixture-of-experts models come from the model cards: Qwen3.6 35B-A3B, Gemma 4 26B-A4B, and gpt-oss. The "Cache layers" column shows how many layers keep a growing cache and how many use a sliding window. Layers that reuse another layer's cache, and linear-attention layers, are left out. DeepSeek R1 distills use the Qwen2.5 or Llama sizes of their base models.
| Model | Params | Active | Layers | Cache layers | Configured context |
|---|---|---|---|---|---|
| Qwen3.5 4BNewer | 4.33B | - | 32 | 8 full | 262,144 |
| Qwen3.5 9BNewer | 9.2B | - | 32 | 8 full | 262,144 |
| Gemma 4 E2BNewer | 4.65B | 2.3B | 35 | 12 window 512 + 3 full | 131,072 |
| Gemma 4 E4BNewer | 7.52B | 4.5B | 42 | 20 window 512 + 4 full | 131,072 |
| Gemma 4 12BNewer | 11.91B | - | 48 | 40 window 1,024 + 8 full | 262,144 |
| Gemma 4 26B-A4B (mixture of experts)Newer | 25.23B | 3.8B | 30 | 25 window 1,024 + 5 full | 262,144 |
| Qwen3.8 27BNewer | 27.32B | - | 64 | 16 full | 262,144 |
| Gemma 4 31BNewer | 30.7B | - | 60 | 50 window 1,024 + 10 full | 262,144 |
| Qwen3.6 35B-A3B (mixture of experts)Newer | 35.51B | 3B | 40 | 10 full | 262,144 |
| gpt-oss 20B (mixture of experts)Newer | 20.91B | 3.6B | 24 | 12 window 128 + 12 full | 131,072 |
| gpt-oss 120B (mixture of experts)Newer | 116.83B | 5.1B | 36 | 18 window 128 + 18 full | 131,072 |
| Llama 3.2 1BOlder | 1.24B | - | 16 | 16 full | 131,072 |
| Llama 3.1 8BOlder | 8.03B | - | 32 | 32 full | 131,072 |
| Qwen3 8BOlder | 8.19B | - | 36 | 36 full | 40,960 |
| Qwen3 14BOlder | 14.77B | - | 40 | 40 full | 40,960 |
| Qwen2.5 14BOlder | 14.77B | - | 48 | 48 full | 32,768 |
| Phi-4 14BOlder | 14.66B | - | 40 | 40 full | 16,384 |
| Qwen3 32BOlder | 32.76B | - | 64 | 64 full | 40,960 |
| Qwen3 30B-A3B (mixture of experts)Older | 30.53B | 3B | 48 | 48 full | 40,960 |
| Llama 3.3 70BOlder | 70.55B | - | 80 | 80 full | 131,072 |
Bits per weight are the real sizes of the downloadable GGUF files, divided by each model's parameter count. I read them from the file listings on Hugging Face on December 4, 2026, for Llama 3.1 8B and Qwen2.5 14B, and the two models agreed within 0.04 bits. The "_M" files are larger than the pure types in Hugging Face's GGUF documentation, because they keep some tensors at higher precision. The cache sizes follow Ollama's FAQ, which describes q8_0 as about half of f16 and q4_0 as about a quarter.