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.

GPUVRAMFits?
NVIDIA GeForce RTX 306012 GB–
NVIDIA GeForce RTX 4070 / 4070 Super12 GB–
NVIDIA GeForce RTX 4060 Ti 16 GB16 GB–
NVIDIA GeForce RTX 4080 / 508016 GB–
NVIDIA Tesla T416 GB–
NVIDIA GeForce RTX 3090 / 409024 GB–
AMD Radeon RX 7900 XTX24 GB–
NVIDIA L424 GB–
NVIDIA GeForce RTX 509032 GB–
NVIDIA RTX A6000 / RTX 6000 Ada48 GB–
NVIDIA A100 80 GB / H100 80 GB80 GB–
NVIDIA H200141 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).

ModelFP16INT8INT4
7B / 8B17.9 GB8.9 GB4.5 GB
13B / 14B31.3 GB15.6 GB7.8 GB
32B / 34B76.0 GB38.0 GB19.0 GB
70B156.5 GB78.2 GB39.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.

Model4k tokens8k tokens32k tokens128k tokens
Llama 3.1 8B0.5 GB1.0 GB4.0 GB16.0 GB
Llama 3.1 70B1.3 GB2.5 GB10.0 GB40.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.

MachineUsable for the modelLargest Q4_K_M modelSpeed
Mac, 16 GB unified memory≈ 11 GB≈ 15BApple Silicon, GPU-accelerated
Mac, 32 GB unified memory≈ 22 GB≈ 33BApple Silicon, GPU-accelerated
Mac, 64 GB unified memory≈ 48 GB≈ 71BApple Silicon, GPU-accelerated
Mac, 96 GB unified memory≈ 72 GB≈ 107BApple Silicon, GPU-accelerated
PC, 16 GB RAM (CPU only)≈ 12 GB≈ 17BNo GPU, slow
PC, 32 GB RAM (CPU only)≈ 24 GB≈ 35BNo GPU, slow
PC, 64 GB RAM (CPU only)≈ 48 GB≈ 71BNo 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

  1. Enter the model size in billions of parameters (e.g., 7 for a 7B model).
  2. Select the precision (data type) used for model weights.
  3. Advanced users can adjust context length, batch size, and overhead for more accurate estimates.
  4. Or pick a model preset (Llama, Qwen, Mistral, Gemma, DeepSeek) to fill in the size and get a layer-accurate KV cache.
  5. Click Calculate Memory to see the weights, KV cache, overhead and total.
  6. 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)

How much VRAM do I need to run an LLM?

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.

How much RAM do I need to run Llama 3 8B or 70B?

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.

Can I run an LLM on CPU with only RAM?

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.

What is the difference between RAM and VRAM for LLMs?

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.

How does context length affect memory?

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.

What affects LLM memory usage?

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.

Why use different precisions?

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.

What do Q4_K_M and Q8_0 mean?

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.

What’s the context length?

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.

Is this estimate exact?

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 Tools