All tools
Context · free, no sign-up

How much memory does my context window cost?

Context is not free. Every token you keep in the conversation is stored as key and value vectors on the card, and that cache keeps growing while the weights stay fixed.

3 inputs4 questions answeredUpdated for 2026 hardware
Context Window Memory Calculator — How much memory does my context window cost?
Answer first

The short answer

Computed from this tool’s default settings — model size and the rest as most people start. Change them below for your own case.

KV cache at this context1.39 GB

At 8,192 tokens the cache costs 1.39 GB, which is less than the 4.50 GB of weights. Halving the context is often cheaper than dropping a quantisation level.

The calculator

Context Window Memory Calculator

See the KV cache grow as you extend context, and where it overtakes the weights.

Your setup

Capacity follows total parameters, even for mixture-of-experts models.

8,192

The KV cache grows linearly with this. It is the biggest lever you have.

Affects the weights, not the KV cache.

KV cache at this context1.39 GB

At 8,192 tokens the cache costs 1.39 GB, which is less than the 4.50 GB of weights. Halving the context is often cheaper than dropping a quantisation level.

Weights4.50 GB
Runtime overhead1.00 GB
Total6.89 GB
Cache share20%
ContextKV cacheTotal memory
1,0240.17 GB5.67 GB
4,0960.70 GB6.20 GB
8,1921.39 GB6.89 GB
16,3842.78 GB8.28 GB
32,7685.56 GB11.1 GB
65,53611.1 GB16.6 GB
131,07222.2 GB27.7 GB
Inputs

What each setting changes

Every input moves the result for a reason. This is what each one does and where to find the value for your own machine.

SettingDefaultWhat it changes
Model size8B — Llama 3.1 8B classCapacity follows total parameters, even for mixture-of-experts models.
Context length8192 tokensThe KV cache grows linearly with this. It is the biggest lever you have.
QuantisationQ4_K_M — 4.5 bits/weightAffects the weights, not the KV cache.
Worked examples

Real answers across model size

The same calculation run at a range of settings, with everything else left at its default. These are computed by the tool itself, not written by hand.

Model sizeKV cache at this contextWeightsRuntime overheadTotal
1B — Llama 3.2 1B class0.49 GB0.56 GB1.00 GB2.05 GB
7B — Mistral / Qwen 7B class1.30 GB3.94 GB1.00 GB6.24 GB
14B — Qwen 14B class1.84 GB7.88 GB1.00 GB10.7 GB
32B — Qwen 32B class2.78 GB18.0 GB1.00 GB21.8 GB
120B — gpt-oss 120B class5.38 GB67.5 GB1.00 GB73.9 GB

At 8,192 tokens the cache costs 0.49 GB, which is less than the 0.56 GB of weights. Halving the context is often cheaper than dropping a quantisation level.

Method

How this is calculated

No lookup tables and no invented constants. Here is the arithmetic, so you can check it against your own numbers.

Memory for a model is three things added together: the weights, which are parameters × bits-per-weight ÷ 8; the KV cache, which grows linearly with context length; and about a gigabyte of runtime overhead for the CUDA context, activations and framework.

Capacity follows a model’s total parameter count even for mixture-of-experts designs, because the router may select any expert on the next token and all of them must stay resident. Only throughput follows the active count.

The KV cache stores key and value tensors for every token in the context, so it grows linearly with context length while the weights stay fixed. At long context on a large model it can rival or exceed the weights themselves.

These are well-founded engineering estimates, not benchmark results. Your quantisation, runtime and context length all move the real number, and usable memory is an assumption rather than a specification. See the full methodology for every assumption behind these figures.

Use cases

Who this is for

The three situations that bring people to this calculation.

Use case 01

Long documents

Check a 32K or 128K context fits before you rely on it.

Use case 02

Debugging OOM

Find the context length that stops the crashes.

Use case 03

Serving

Budget cache per session before setting a concurrency limit.

Walkthrough

How to use this calculator

Four steps, no account, nothing leaves your browser.

  1. Set model size

    Start at the top of the panel. Every figure recalculates as you change it — there is no submit button, because watching the number move is the point.

  2. Adjust the rest to match your setup

    2 further settings: context length, quantisation. Defaults are the common case, so change only what differs for you.

  3. Read the headline, then the table

    The large figure answers the question. The table underneath shows how the answer changes across nearby settings, which is usually where the decision actually gets made.

  4. Check it against the method

    The arithmetic is written out above. If a number looks wrong for your hardware, the assumptions are the first place to look — usable memory and quantisation are the two that vary most.

Questions

How much memory does my context window cost: common questions

The questions people ask about this, answered without hedging.

Why does a longer context use more VRAM?

The KV cache stores one key and one value vector per token per layer. Double the tokens and you double the cache. Weights do not change, which is why a model can load fine and then run out of memory an hour into a conversation.

Can I reduce KV cache memory?

Yes, three ways: shorten the context, enable flash attention, or quantise the cache itself — llama.cpp exposes 8-bit and 4-bit KV cache, which halves or quarters it for a small quality cost on long contexts.

Does a 128K context model always use 128K of cache?

No. The cache is allocated for the context you configure and filled as the conversation grows. Setting a smaller --ctx-size than the model supports is the normal way to run a long-context model on a small card.

Is more context always better?

No. Attention quality thins across a very long window, and cost grows the whole time. Retrieving the right 4K usually beats stuffing 100K.

The rest of the set

All 50 run on the same arithmetic, so answers across them agree.

Coverage

Searches this page answers

Different ways of asking the same question, all resolved above.

kv cache vram calculatorcontext length memory usage llmhow much vram for 128k contextllm context window memoryreduce kv cache memorycontext size vramnum_ctx memoryhow much memory does my context window costcontext window memory calculatorcontext window memory calculator onlinefree context window memory calculator
Next step

Now find the models that fit

Sizing is only half the problem. Model Radar takes your hardware and shows which models actually run on it, ranked by what they are good at — the same arithmetic as this page, applied to every model worth running.