LLM VRAM calculator: will this model fit your GPU or Mac?
This calculator estimates the VRAM or unified memory an LLM needs from your machine, model, quantization and context length. Check backend support and peak memory with a representative run.

What the estimate covers. The calculator does arithmetic on published model configurations. It tells you whether a setup is worth trying. Speed, and whether your engine accepts the setup, only show up when you run it. Where I have run a matching setup myself, the result links to that measurement. Treat every other result as a starting point to measure on your own machine. The model figures were read from published configurations on 8 October 2026, and two of my own runs from August 2026 check the arithmetic: see Estimates against measurements.
The calculator
The calculator needs JavaScript. The formula and a worked example are below, so you can do the same sum by hand.
The formula
The memory a model needs is the sum of four parts. Each is counted for one request; a server holding several conversations pays the KV cache once per conversation.
| Part | Formula | What it depends on |
|---|---|---|
| Weights | total parameters × bits per weight ÷ 8 | Every parameter, including every expert of a mixture-of-experts model |
| KV cache | 2 (keys and values) × attention layers × KV heads × head dimension × bytes per element × tokens | Context length and cache precision; sliding-window layers stop at their window |
| Recurrent state | linear-attention layers × heads × key dimension × value dimension × 4 bytes | Fixed per request in hybrid models; zero in plain transformers |
| Runtime overhead | 1.5 GiB + 5% of the weights | The engine, its compute buffers and activations |
The worked example below uses Qwen 3.8 27B with a 32,768-token context and a 16-bit cache. Its cache is small for a model of its size, because only 16 of its 64 layers use full attention. Each part is rounded to 0.1 GiB.
| Quantization | Weights | KV cache | State + overhead | Total |
|---|---|---|---|---|
| NVFP4 · 4.5 bits | 14.6 GiB | 2.0 GiB | 2.4 GiB | 18.9 GiB |
| Q4_K_M · 4.9 bits | 15.8 GiB | 2.0 GiB | 2.4 GiB | 20.3 GiB |
| Q8_0 · 8.52 bits | 27.6 GiB | 2.0 GiB | 3.0 GiB | 32.6 GiB |
| BF16 · 16 bits | 51.7 GiB | 2.0 GiB | 4.2 GiB | 58.0 GiB |
The verdict compares the estimate with a memory budget. Discrete-GPU offload scenarios also count free system RAM after an 8 GiB operating-system allowance; they assume the selected backend can offload that model. Mac and Linux unified-memory scenarios use the documented planning allowances below.
The estimate identifies configurations worth testing. Memory capacity alone does not establish runtime support, peak allocation or latency; a model that loads can still be too slow for the task.
Every assumption
- Bits per weight are effective rates. The GGUF rates are file size ÷ parameters on llama.cpp’s own reference model: Q2_K 3.17, Q3_K_M 4.0, Q4_K_M 4.9, Q5_K_M 5.7, Q6_K 6.57 and Q8_0 8.52. They sit above the nominal rates because each mix keeps some tensors at higher precision. NVFP4 is 4.5 (4-bit values with one FP8 scale per 16), FP8 is 8 and BF16 is 16.
- Mixed-precision checkpoints run larger. Exports that keep attention, embeddings or shared experts in BF16 are bigger than the rate suggests. Where a published file size is known for the chosen model and quantization, the calculator uses that file for the weights and the verdict. The formula’s figure then appears in a note.
- Cache precision. FP16 and BF16 use 2 bytes per element and FP8 uses 1 before implementation overhead. llama.cpp’s q8_0 and q4_0 blocks include scale storage. The calculator offers selected cache formats for its assumed backend paths; the runtime may support additional formats or impose model-specific restrictions.
- Overhead is a planning allowance. The 1.5 GiB plus 5% rule is a heuristic, not an upper bound. Workspaces, activations, graph capture, recurrent-state slots and optional components can require more. Measure peak loading and representative prefill, not only idle loaded memory.
- Macs. By default macOS lets the GPU wire about 75% of unified memory on the sizes listed here. The figure comes from community documentation; Apple does not publish it.
sudo sysctl iogpu.wired_limit_mb=<MB>raises it until the next reboot, and0restores the default. The calculator says when a setup fits only after raising it, and keeps 8 GiB for macOS. - Offload. An estimated fit across GPU memory and free RAM does not guarantee the selected engine can run it. Check model/backend offload support and measured latency. Active expert count alone does not determine the penalty.
- Custom models are treated as plain transformers: every layer is full attention with separate keys and values. A hybrid or sliding-window model entered that way will show too large a cache.
The cases a simple formula gets wrong
- Mixture of experts. “3B active” or “6B active” describes the compute each token uses. The weights line still counts every expert, so gpt-oss-120b is sized as 117B parameters even though about 5.1B work on each token.
- Hybrid attention. Qwen 3.8 27B, Qwen 3.6 35B-A3B and Flash-Next use full attention on only one layer in four. The other layers keep a fixed recurrent state that does not grow with context. That is why the 27B pays 64 KiB per token at 16 bits and 32 KiB at FP8. It is also why its full 262K window costs 8 GiB of FP8 cache.
- Sliding windows. Half of gpt-oss’s layers attend to the last 128 tokens and five of every six of Gemma 4’s to the last 1,024. Those layers stop growing at the window. Gemma 4’s global layers share one tensor for keys and values, so the calculator counts them once. An engine that stores both would need more for that part.
- Flash-Next’s n-gram table. About 51B of its 180B parameters are an n-gram embedding table that the model only reads by lookup and never computes through. The table can live in host RAM or be read from SSD or NVMe, which is how every small Flash-Next setup works. The calculator sizes the table separately and says when a setup fits only with the table off the GPU. GGUF builds keep the table at 4-bit or above, and NVIDIA’s NVFP4 export stores it in FP8. The table keeps that precision whichever weight format you pick. Its source-checked sizes and runtimes are in the Flash-Next requirements.
- Not modelled. The calculator leaves out vision encoders’ image buffers, speculative drafters (a second model needs its own weights and cache), Flash-Next’s sparse-attention indexer cache and several concurrent requests. A drafter is often what decides whether a long window fits; SGLang vs vLLM shows that trade on one card.
Estimates against measurements
Two of my own measurements check the arithmetic. On the RTX 5090, Qwen 3.8 27B in NVFP4 with an FP8 cache held a physical KV pool of 114,688 tokens. The formula gives 3.5 GiB for that pool, with no rounding, and the engine’s startup log reported the same 3.5 GiB. On the 128 GB M4 Max, the MLX 8-bit weights are about 29.5 GB; Q8_0’s rate gives 29.6 GB.
The calculator is weakest where checkpoints mix precisions. For Flash-Next in NVFP4 it estimates 115 GiB of weights against NVIDIA’s published 123.57 GiB, because that export keeps attention and shared experts in BF16. That is why the calculator uses a published file size wherever one is known. When the headroom is smaller than the estimate’s planning uncertainty allowance (10% of every formula-sized part, 3% of a published file), the verdict says “measure first”.
How these figures were gathered. Layer counts, attention layouts, KV heads, head dimensions and parameter counts were read from each model’s Hugging Face configuration, parameter count and model card on 8 October 2026. The calculator’s code records the source of every value. The quantization rates come from llama.cpp’s quantize tool and NVIDIA’s NVFP4 description, read the same day. The two cross-checks are my own runs from August 2026.
For worked examples, the 24 GB and 48 GB Mac list applies this rule to recent models, the Jais 3 note sizes each Arabic model from 0.9B to 36B against Mac memory, and the MiniCPM-V 4.7 note shows a mixture-of-experts model that streams experts from the SSD to beat the simple formula.
Sources

Want this inside your team’s workflow? The Verified AI Operations Sprint tests one workflow in ten working days. See the sprint →