LLM VRAM and RAM Calculator
Find how much VRAM or RAM a local LLM needs for any model size, GGUF quantization and context length, and whether it fits your GPU, Mac or PC.
- Runs in your browser
- Nothing is uploaded
- Free, no sign-up
Model details and KV cache type
For a model not in the list, copy num_hidden_layers, num_key_value_heads and head_dim (or hidden_size divided by num_attention_heads) from its config.json on Hugging Face.
Memory needed
-
- Model weights
- KV cache (context)
- Runtime buffers
Longest context that fits:
Every quantization of this model at your context length
| Type | Weights | Total | Your device |
|---|
This free LLM VRAM calculator estimates how much GPU memory or system RAM a local language model needs, for any model size, GGUF quantization and context length. It splits the total into model weights, KV cache and buffers, tells you whether it fits your graphics card, Mac or PC, and finds the longest context you can use. It runs in your browser with no sign-up.
How to calculate VRAM for an LLM
The memory a model needs comes from three parts:
Memory = weights + KV cache + buffers
Weights = parameters x bits per weight / 8
KV cache = 2 x layers x KV heads x head size x context x bytes per value
Buffers = about 0.5 GBFor Llama 3.1 8B at Q4_K_M with an 8K context: the weights are 8.03 billion x 4.89 / 8 = 4.9 GB, the KV cache is 2 x 32 x 8 x 128 x 8,192 x 2 bytes = 1.07 GB, and with buffers the total is about 6.5 GB. The bits per weight for each quantization come from the llama.cpp quantize README; the layer and head counts come from each model's config file on Hugging Face.
How much VRAM do I need for 8B, 14B, 32B and 70B models?
Total memory at Q4_K_M with the default F16 KV cache, worked out with the same formula:
| Model | Weights | Total, 8K context | Total, 32K context |
|---|---|---|---|
| Llama 3.2 3B | 1.96 GB | 3.40 GB | 6.22 GB |
| Llama 3.1 8B | 4.91 GB | 6.48 GB | 9.70 GB |
| Qwen3 8B | 5.01 GB | 6.71 GB | 10.3 GB |
| Mistral Nemo 12B | 7.49 GB | 9.33 GB | 13.4 GB |
| Qwen3 14B | 9.03 GB | 10.9 GB | 14.9 GB |
| Qwen3 30B-A3B (MoE) | 18.7 GB | 20.0 GB | 22.4 GB |
| Qwen3 32B | 20.0 GB | 22.7 GB | 29.1 GB |
| Llama 3.3 70B | 43.1 GB | 46.3 GB | 54.4 GB |
As a rule, a model at Q4_K_M needs about 0.6 GB per billion parameters plus its KV cache. Our guide to what Q4_K_M means explains how the quantization types compare in size and quality.
KV cache size per token
The KV cache is the memory a model uses to remember the conversation so far, and it is why long contexts are expensive. It grows by the same amount for every token, set by the number of layers, KV heads and head size. Models that share keys and values across many attention heads, such as Qwen2.5 7B and Qwen3 30B-A3B with 4 KV heads, need much less:
| Model | Layers x KV heads x head size | Per token (F16) | 8K context | 32K context |
|---|---|---|---|---|
| Llama 3.2 3B | 28 x 8 x 128 | 115 KB | 0.94 GB | 3.76 GB |
| Llama 3.1 8B | 32 x 8 x 128 | 131 KB | 1.07 GB | 4.29 GB |
| Qwen3 8B | 36 x 8 x 128 | 147 KB | 1.21 GB | 4.83 GB |
| Mistral Nemo 12B | 40 x 8 x 128 | 164 KB | 1.34 GB | 5.37 GB |
| Qwen3 14B | 40 x 8 x 128 | 164 KB | 1.34 GB | 5.37 GB |
| Qwen3 30B-A3B (MoE) | 48 x 4 x 128 | 98 KB | 0.81 GB | 3.22 GB |
| Qwen3 32B | 64 x 8 x 128 | 262 KB | 2.15 GB | 8.59 GB |
| Llama 3.3 70B | 80 x 8 x 128 | 328 KB | 2.68 GB | 10.7 GB |
Switching the KV cache to Q8_0 halves these numbers with little quality loss, and Q4_0 quarters them. In Ollama, set OLLAMA_FLASH_ATTENTION=1 and OLLAMA_KV_CACHE_TYPE=q8_0.
VRAM vs RAM: graphics card, Mac or CPU only
- Graphics card. The whole model should fit in VRAM. The calculator keeps 0.5 GB back for the display and driver. If it does not fit, layers spill into system RAM and generation slows down sharply.
- Apple Silicon Mac. The GPU shares the Mac's unified memory, but by default macOS lets it use only about two-thirds of it on Macs with up to 36 GB, and about three-quarters on larger ones. A 16 GB Mac gives a model about 11 GB.
- CPU only. The model runs from system RAM after the operating system and a browser take their share. The calculator assumes Windows uses about 4 GB plus an eighth of your RAM, and a light Linux desktop about 2.5 GB plus a sixteenth. That leaves about 3 GB of 8 GB on Windows and about 5 GB on Linux.
For model picks at each size, see the best LLM for 8GB RAM, the best local LLM for 16GB RAM and the best local LLM for 32GB RAM.
What this calculator does not include
- Sliding-window attention. Gemma 3 and gpt-oss keep a full KV cache in only some layers, so they need much less memory for long contexts than this formula shows.
- Vision and audio. Multimodal models load an extra projector file of a few hundred MB to over 1 GB.
- Several users at once. Serving parallel requests multiplies the KV cache by the number of slots.
- Training and fine-tuning. These need several times more memory than running a model.
To see how many tokens your own prompts use, paste them into the AI Token Counter. For the bigger picture, read how to run an LLM locally, or see all free in-browser tools.
Frequently asked questions
How much VRAM do I need to run a 7B or 8B model?
Llama 3.1 8B needs about 6.5 GB at Q4_K_M with an 8K context: roughly 4.9 GB for the weights, 1 GB for the KV cache and 0.5 GB for buffers. Qwen2.5 7B needs about 5.6 GB because its KV cache is smaller. An 8 GB graphics card runs either fully on the GPU. A 6 GB card needs a smaller quantization such as Q3_K_M, a shorter context, or some layers in system RAM.
How much RAM do I need for a 70B LLM?
At Q4_K_M a 70B model such as Llama 3.3 70B needs about 43 GB for the weights alone, so plan on 48 GB of VRAM or a Mac with 64 GB of unified memory for a useful context. On a PC without a big GPU it needs 64 GB of RAM and runs at only a token or two per second.
Can I run an LLM with 8 GB of VRAM?
Yes. With 8 GB of VRAM you can run 7B to 9B models at Q4_K_M with a context of about 8K to 12K tokens, fully on the GPU, or longer with a Q8_0 KV cache. Larger models such as 12B to 14B need Q3 quantization or partial offloading to system RAM, which works but is much slower.
What is the KV cache, and why does context use so much memory?
While a model writes, it keeps the keys and values of every earlier token so it does not have to recompute them. That store is the KV cache. It grows in a straight line with context length: Llama 3.1 8B needs about 131 KB per token at F16, so 8K tokens take about 1 GB and 128K tokens take about 17 GB.
Does an MoE model like Qwen3 30B-A3B need less memory?
No. A mixture-of-experts model only uses some of its parameters for each token, which makes it much faster, but all of the experts must still be loaded. Qwen3 30B-A3B needs memory for all 30.5 billion parameters, about 18.7 GB at Q4_K_M, while running at roughly the speed of a 3B model.
Does quantizing the KV cache hurt quality?
A Q8_0 KV cache halves its size with a very small loss, and is a good choice for long contexts. Q4_0 quarters it but costs more quality. In Ollama, set OLLAMA_FLASH_ATTENTION=1 and OLLAMA_KV_CACHE_TYPE=q8_0; in llama.cpp, use the cache-type-k and cache-type-v options with flash attention on.
Why is my real memory use different from the estimate?
Bits per weight vary a little between models because some tensors keep more bits, apps reserve different buffer sizes, and vision models load an extra projector file. Models with sliding-window attention, such as Gemma 3 and gpt-oss, need much less KV cache than this formula gives. Treat the result as a planning estimate within about 10 percent.
Can I split a model between GPU and system RAM?
Yes. Ollama does it automatically, and llama.cpp lets you choose the number of GPU layers. The model will load, but every layer left in system RAM runs at CPU speed, so generation can drop from 40 tokens per second to 5 or less. Fitting the whole model in VRAM is what makes a GPU fast.
Topic
More on Local LLMs
- GuideBest Local LLM for 16GB RAM: 10 Models That Fit (2026)The best local LLMs for 16GB RAM and no GPU: 10 models that fit, real Ollama sizes, speed estimates, and the popular picks that only fit a 16GB GPU.
- GuideBest Local LLM for 32GB RAM: 10 Models That Fit (2026)The best local LLMs for 32GB RAM and no GPU: 10 models that fit, real Ollama sizes, and why mixture-of-experts models run 5 to 10 times faster on a CPU.
- GuideWhat Is Q4_K_M? GGUF Quantization Explained (2026)What Q4_K_M means in a GGUF file, how it compares with Q4_K_S, Q5_K_M, Q6_K, Q8_0, IQ4_XS and UD-Q4_K_XL, and which quantization to download for your RAM.
- GuideBest LLM for 8GB RAM, CPU Only: 9 Open Source Picks (2026)The best open source LLMs for 8GB RAM and no GPU: 9 models that fit, real download sizes, speed estimates and Ollama setup for Windows, Mac and Linux.
- AI Token CounterCount tokens exactly for GPT-5, GPT-4o and GPT-4, with estimates for Claude and Gemini, context window fit and cost. Free, nothing is uploaded.
More text and code tools
View all tools- QR Code GeneratorTurn any link or text into a QR code and download it as PNG or SVG. Static codes that never expire and carry no tracking. Free, private.
- Text to Hex ConverterConvert text to hex and back. See the UTF-8 bytes, Unicode code points and HTML entities of any character, emoji included. Free and private.
- Base64 Encode and DecodeEncode text to Base64 or decode Base64 to text, with UTF-8, emoji and URL-safe Base64URL support plus a Basic auth header builder. Free, private.
- Text to MD5 Hash GeneratorConvert text to an MD5 hash as you type. Hash a whole list at once, add a salt, or check text against an existing hash. Free, nothing is uploaded.
- Document TimestampProve a PDF or Word file existed on a date. Its SHA-256 hash is recorded in the public Sigstore Rekor log. Free, and the file never leaves your device.
- Bitcoin Timestamp (OpenTimestamps)Timestamp any file on the Bitcoin blockchain with OpenTimestamps, then verify or upgrade the .ots proof. Free, and your file never leaves your device.