LLM RAM & VRAM Calculator: How Much Memory Do I Need?
Estimate the RAM or GPU memory (VRAM) needed to run a large language model (LLM) locally based on model size, quantization, context length and batch size, then check which GPUs, Macs and PCs can run it.
RAM vs VRAM: a model run on a GPU has to fit in the card's VRAM. A model run on the CPU uses system RAM, and Apple Silicon Macs share one pool of unified memory between CPU and GPU. The memory needed is the same number either way.
Can I Run It?
Calculate an estimate above to see which of these common GPUs have enough memory for your model.
| GPU | VRAM | Fits? |
|---|---|---|
| NVIDIA GeForce RTX 3060 | 12 GB | – |
| NVIDIA GeForce RTX 4070 / 4070 Super | 12 GB | – |
| NVIDIA GeForce RTX 4060 Ti 16 GB | 16 GB | – |
| NVIDIA GeForce RTX 4080 / 5080 | 16 GB | – |
| NVIDIA Tesla T4 | 16 GB | – |
| NVIDIA GeForce RTX 3090 / 4090 | 24 GB | – |
| AMD Radeon RX 7900 XTX | 24 GB | – |
| NVIDIA L4 | 24 GB | – |
| NVIDIA GeForce RTX 5090 | 32 GB | – |
| NVIDIA RTX A6000 / RTX 6000 Ada | 48 GB | – |
| NVIDIA A100 80 GB / H100 80 GB | 80 GB | – |
| NVIDIA H200 | 141 GB | – |
Quick Reference: Memory (RAM or VRAM) by Model Size
Estimates using this calculator's defaults (2,048-token context, batch size 1, 20% overhead).
| Model | FP16 | INT8 | INT4 |
|---|---|---|---|
| 7B / 8B | 17.9 GB | 8.9 GB | 4.5 GB |
| 13B / 14B | 31.3 GB | 15.6 GB | 7.8 GB |
| 32B / 34B | 76.0 GB | 38.0 GB | 19.0 GB |
| 70B | 156.5 GB | 78.2 GB | 39.1 GB |
- Leave some headroom: long context windows need extra memory for the KV cache, and your desktop and drivers use VRAM too.
- Apple Silicon Macs share memory between the CPU and GPU, and macOS keeps part of it for the system, so only some of a Mac's unified memory is available to the model.
- If a model doesn't fit, try a smaller quantization (for example INT4 instead of FP16), split it across several GPUs, or offload some layers to system RAM at the cost of speed.
KV Cache by Context Length
The KV cache stores the keys and values for every token in the context, so it grows with context length and batch size on top of the model weights. FP16 cache, batch size 1. For a per-layer breakdown, GQA vs MHA comparison, FP8/INT4 cache sizes and any custom model, use the dedicated KV cache calculator. Need to know how many tokens your text uses? Try the token calculator.
| Model | 4k tokens | 8k tokens | 32k tokens | 128k tokens |
|---|---|---|---|---|
| Llama 3.1 8B | 0.5 GB | 1.0 GB | 4.0 GB | 16.0 GB |
| Llama 3.1 70B | 1.3 GB | 2.5 GB | 10.0 GB | 40.0 GB |
What Fits in RAM? Macs and CPU-Only PCs
Not everyone has a big GPU. Apple Silicon Macs can use most of their unified memory for the GPU, and any PC can run a quantized model from system RAM. This table shows the largest model that fits at GGUF Q4_K_M (about 4.8 bits per weight, 4,096-token context, 20% overhead), assuming only part of the memory is available to the model.
| Machine | Usable for the model | Largest Q4_K_M model | Speed |
|---|---|---|---|
| Mac, 16 GB unified memory | ≈ 11 GB | ≈ 15B | Apple Silicon, GPU-accelerated |
| Mac, 32 GB unified memory | ≈ 22 GB | ≈ 33B | Apple Silicon, GPU-accelerated |
| Mac, 64 GB unified memory | ≈ 48 GB | ≈ 71B | Apple Silicon, GPU-accelerated |
| Mac, 96 GB unified memory | ≈ 72 GB | ≈ 107B | Apple Silicon, GPU-accelerated |
| PC, 16 GB RAM (CPU only) | ≈ 12 GB | ≈ 17B | No GPU, slow |
| PC, 32 GB RAM (CPU only) | ≈ 24 GB | ≈ 35B | No GPU, slow |
| PC, 64 GB RAM (CPU only) | ≈ 48 GB | ≈ 71B | No GPU, slow |
- Macs limit how much unified memory the GPU can use (roughly two-thirds on smaller Macs, about three-quarters on larger ones by default), and macOS needs the rest.
- CPU-only inference reads the whole model from system RAM for every token, which is often an order of magnitude or more slower than a GPU. Smaller or more heavily quantized models help.
- Figures are estimates; see the tokens per second calculator for speed and the self-host vs API calculator for cost.
How to Use
- Enter the model size in billions of parameters (e.g., 7 for a 7B model).
- Select the precision (data type) used for model weights.
- Advanced users can adjust context length, batch size, and overhead for more accurate estimates.
- Or pick a model preset (Llama, Qwen, Mistral, Gemma, DeepSeek) to fill in the size and get a layer-accurate KV cache.
- Click Calculate Memory to see the weights, KV cache, overhead and total.
- Check the Can I Run It? table to see which GPUs have enough memory, and the RAM table for Macs and CPU-only PCs.
Frequently Asked Questions (FAQ)
Roughly the number of parameters times the bytes per parameter, plus some overhead. At FP16 that is about 2 GB per billion parameters, so a 7B model needs around 16 GB. 4-bit quantization cuts that to about a quarter.
Llama 3 8B needs about 18 GB at FP16, about 9 GB at 8-bit and about 5–6 GB at 4-bit (Q4_K_M), including 20% overhead and a short context. Llama 3 70B needs about 158 GB at FP16, about 79 GB at 8-bit and about 47 GB at 4-bit. Long contexts add KV cache on top: 8B adds 1 GB per 8k tokens, 70B adds 2.5 GB per 8k tokens.
Yes. Runtimes such as llama.cpp and Ollama can run models entirely from system RAM, and the same memory estimate applies. Expect it to be much slower than a GPU, often an order of magnitude or more, because system RAM has far less memory bandwidth than GPU VRAM. Small quantized models (7B–8B at 4-bit) are the practical sweet spot.
VRAM is the memory on your graphics card; RAM is your computer’s main memory. A model run on a GPU must fit in VRAM (or spill over to RAM, which is slow). A model run on the CPU uses system RAM. Apple Silicon Macs use unified memory shared by CPU and GPU, so one pool of RAM serves both.
Every token in the context window stores a key and a value vector for each layer, called the KV cache, so it grows linearly with context length and batch size. For Llama 3.1 8B at FP16 that is 128 KB per token: 1 GB at 8k tokens and 16 GB at 128k tokens. Doubling the context doubles the KV cache; the weights stay the same.
The main factors are model size (parameters), precision (data type), context length, and batch size. Using lower precision or smaller context windows can reduce memory requirements.
Lower precision (like INT4 or INT8) reduces memory usage with minimal impact on model quality. FP16/BF16 are common for inference, while FP32 is typically used during training.
They are GGUF quantization formats used by llama.cpp and Ollama. Q4_K_M uses about 4.8 bits per weight, Q5_K_M about 5.7, Q6_K about 6.6 and Q8_0 about 8.5, slightly more than the plain 4, 5, 6 and 8 bits because block scales are stored too. Q4_K_M is the usual balance of size and quality.
Context length is the maximum number of tokens the model can process at once. Longer contexts allow processing more text but require more memory. Use the AI tokens calculator to count how many tokens your text uses.
This is an approximation. Actual memory usage may vary based on implementation, overhead, and system-specific factors. When you pick a model preset the KV cache uses that model’s real layer, head and dimension counts (FP16 cache); with a custom size it uses a generic estimate. Always add a safety margin.
About LLM Memory Requirements
Large Language Models require significant memory for both their weights and working memory (activations). The total memory requirement consists of:
- Model Weights: Parameters × Bytes per parameter (varies by precision)
- Activation Memory: Context length × Batch size × Bytes per token
- Overhead: Additional memory for caching, gradients (during training), and system operations
Calculation Formula
Total VRAM = (Model Weights + Context Memory) × Overhead Factor
where:
- Model Weights = Number of Parameters × Bytes per Parameter
- Context Memory = Context Length × Batch Size × 2 bytes
- Overhead Factor = (100 + Overhead %) ÷ 100
Note: This calculator provides estimates for inference scenarios. Training requires additional memory for gradients and optimizer states, typically 2-3x more than inference.
Try More Free Tools!
Explore our full collection of developer, text, and media tools to boost your productivity.
Browse All ToolsSee also
- Check which models' context windows your prompt fits in, and what that context costs in KV cache, with the LLM context window calculator.
Related Tools
- KV Cache CalculatorMemory per token and total KV cache from layers, KV heads, head dimension, context, batch and precision, with GQA and context-length views.
- LLM Tokens per Second CalculatorEstimate local LLM generation speed from GPU memory bandwidth, model size and quantization.
- Self-Host vs API Cost Calculator (LLM Break-Even)Compare monthly LLM API cost with self-hosting on a rented or owned GPU and find the break-even token volume. All assumptions shown.
- GPU Rental Cost CalculatorEstimate cloud GPU cost per job and per month from hourly rate, GPU count, job and idle hours, storage and egress. Example rates are dated and editable.
- LLM Training Cost CalculatorEstimate LLM training or fine-tuning compute, GPU-hours and dollar cost from parameters, tokens, epochs, GPU type and utilisation using the 6 × N × D rule of thumb.
- LLM API Rate Limit CalculatorTurn requests per minute and average tokens into tokens per minute (TPM) and concurrency, check if your RPM/TPM tier is enough, and get headroom and backoff advice. Runs in your browser.