Skip to main content
All free tools

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
Your hardware

Card sizes are in GiB, as GPU tools report them. For Macs I assume the GPU can use 65 percent of unified memory. That share is my assumption, not an Apple figure.

Use 0 if you have no dedicated GPU. On a Mac, enter the part of unified memory you let the GPU use.

Only matters when a model spills out of video memory.

Your model

Presets fill in the four numbers below. For hybrid and sliding-window models they also set how the cache is counted. Editing a number switches to Custom.

Paste a Hugging Face config.json

Open a model's config.json on Hugging Face, copy all of it, and paste it here. The tool reads the layers, KV heads, head size, and maximum context. It cannot read the parameter count, because that file does not contain one. Enter that yourself, from the model card.

Context and cache

Ollama defaults to 4,096 tokens under 24 GiB of video memory. Agents and coding tools work better with 64K or more.

Each parallel request needs its own context cache.

Ollama needs Flash Attention for a quantized cache, and the q4_0 setting can cost some quality at long context.

Advanced assumptions

Scratch buffers and the graphics driver. This is my assumption, not a measured value, so raise it if a model that "fits" still fails to load.

Subtracted from system memory before checking partial offload.

By default, Gemma 4, gpt-oss, and similar models are counted with a small window cache on most layers. Turn this on if your runtime keeps a full cache, which gives an upper bound.

Optional. Real files mix quantization types, so their size differs a little from the estimates. Enter 0 to skip.

Will it fit?

Best fit for your setup

Estimate tokens per second
  • Weights
  • Context cache
  • Overhead
  • Your video memory
Estimated memory per quantization for the chosen model
QuantizationResultMemoryMax 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 architecture figures used by the presets
ModelParamsActiveLayersCache layersConfigured context
Qwen3.5 4BNewer4.33B-328 full262,144
Qwen3.5 9BNewer9.2B-328 full262,144
Gemma 4 E2BNewer4.65B2.3B3512 window 512 + 3 full131,072
Gemma 4 E4BNewer7.52B4.5B4220 window 512 + 4 full131,072
Gemma 4 12BNewer11.91B-4840 window 1,024 + 8 full262,144
Gemma 4 26B-A4B (mixture of experts)Newer25.23B3.8B3025 window 1,024 + 5 full262,144
Qwen3.8 27BNewer27.32B-6416 full262,144
Gemma 4 31BNewer30.7B-6050 window 1,024 + 10 full262,144
Qwen3.6 35B-A3B (mixture of experts)Newer35.51B3B4010 full262,144
gpt-oss 20B (mixture of experts)Newer20.91B3.6B2412 window 128 + 12 full131,072
gpt-oss 120B (mixture of experts)Newer116.83B5.1B3618 window 128 + 18 full131,072
Llama 3.2 1BOlder1.24B-1616 full131,072
Llama 3.1 8BOlder8.03B-3232 full131,072
Qwen3 8BOlder8.19B-3636 full40,960
Qwen3 14BOlder14.77B-4040 full40,960
Qwen2.5 14BOlder14.77B-4848 full32,768
Phi-4 14BOlder14.66B-4040 full16,384
Qwen3 32BOlder32.76B-6464 full40,960
Qwen3 30B-A3B (mixture of experts)Older30.53B3B4848 full40,960
Llama 3.3 70BOlder70.55B-8080 full131,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.