Skip to content
PickZeal
    Text and code tools

    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

    TypeWeightsTotalYour 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 GB

    For 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:

    ModelWeightsTotal, 8K contextTotal, 32K context
    Llama 3.2 3B1.96 GB3.40 GB6.22 GB
    Llama 3.1 8B4.91 GB6.48 GB9.70 GB
    Qwen3 8B5.01 GB6.71 GB10.3 GB
    Mistral Nemo 12B7.49 GB9.33 GB13.4 GB
    Qwen3 14B9.03 GB10.9 GB14.9 GB
    Qwen3 30B-A3B (MoE)18.7 GB20.0 GB22.4 GB
    Qwen3 32B20.0 GB22.7 GB29.1 GB
    Llama 3.3 70B43.1 GB46.3 GB54.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:

    ModelLayers x KV heads x head sizePer token (F16)8K context32K context
    Llama 3.2 3B28 x 8 x 128115 KB0.94 GB3.76 GB
    Llama 3.1 8B32 x 8 x 128131 KB1.07 GB4.29 GB
    Qwen3 8B36 x 8 x 128147 KB1.21 GB4.83 GB
    Mistral Nemo 12B40 x 8 x 128164 KB1.34 GB5.37 GB
    Qwen3 14B40 x 8 x 128164 KB1.34 GB5.37 GB
    Qwen3 30B-A3B (MoE)48 x 4 x 12898 KB0.81 GB3.22 GB
    Qwen3 32B64 x 8 x 128262 KB2.15 GB8.59 GB
    Llama 3.3 70B80 x 8 x 128328 KB2.68 GB10.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

    See the full Local LLMs guide

    More text and code tools

    View all tools