Free · no signup · browser-local

LLM Weight and KV Cache Memory Calculator in GB and GiB

Calculate theoretical weight and dense full-attention KV cache memory from parameters, precision, layers, KV heads, context and batch. Add manual overhead and a safety margin.

Browse all tools →

Browser-local manual calculation · no model lookup · no saved inputs

Architecture and budget

Enter your architecture values. The example is an invented 8-billion-parameter calculation, not a real model preset or a device recommendation.

Weights

Dense full-attention KV cache

2 × layers × KV heads × head dimension × cached tokens × batch × KV bits ÷ 8

Context includes prompt plus generated tokens. Use KV heads, not query heads. Batch means simultaneous equal-length cached sequences. Low-bit KV is ideal packed storage; implementation overhead is not inferred.

Runtime allowance and capacity

Method and limits

1 GB = 1,000,000,000 bytes; 1 GiB = 1,073,741,824 bytes. Weight bytes = parameter count × bits ÷ 8. KV bytes count a key tensor and a value tensor for every layer and cached sequence.

For dense full-attention inference only. MLA, SSM, sliding/chunked attention, paged caches, offloading and actual kernels need different accounting. Quantized scales, alignment and residual precision are not automatically modeled. Training gradients and optimizer state are excluded.

Exact bounded decimal/BigInt arithmetic preserves values in JSON/CSV. Fractional bytes describe ideal packed bits, not a real allocation. All inputs stay in this page; no storage, API or model calls.

Hugging Face: cache strategies and tradeoffs · Cache tensor API

Your output

llm-memory-calculator-report.json

Complete the input to preview and export your result.

Getting started

Enter parameter count, precision, layer and KV dimensions, context, batch and manual overhead. Compare GB/GiB totals with a stated capacity.

Before you use the result

This is a planning estimate, not a measured model footprint or a guarantee that hardware can run a model. MLA, SSM, paging, sliding windows and offloading are outside this full-attention formula.

Try an example

An 8-billion-parameter example at 4 bits has 4 GB of raw weights before quantization metadata, KV cache and runtime overhead.

How it works

Raw weight bytes = parameters × bits / 8. KV bytes = 2 × layers × KV heads × head dimension × context × batch × KV bits / 8. Manual overhead and safety margin are reported separately.

Frequently asked questions

Estimate theoretical model weight and full-attention KV memory from explicit parameters and your overhead budget.

How do I use LLM Weight and KV Cache Memory Calculator?

Enter parameter count, precision, layer and KV dimensions, context, batch and manual overhead. Compare GB/GiB totals with a stated capacity.

Does this tool upload my data?

Inputs and files are processed in your browser. Page-view analytics do not contain your tool input.

What should I check before using the result?

This is a planning estimate, not a measured model footprint or a guarantee that hardware can run a model. MLA, SSM, paging, sliding windows and offloading are outside this full-attention formula.