# VRAM calculator

Enter the parameter count, the bits per weight and the context memory. The tool estimates the memory a local model needs, in gigabytes.

Use the tool on the [web page](https://localmodels.fyi/tools/vram-calculator). It works without JavaScript.

## How to use it

1. Enter parameters in billions.
2. Enter bits per weight.
3. Enter context memory in gb.
4. Enter runtime overhead as a percent.
5. Read the result.

## How it works

Weights in GB = parameters in billions x bits per weight / 8. A model with 8 billion parameters at 16 bits is about 16 GB. At 4.8 bits it is about 4.8 GB.

Estimated memory = weights x (1 + overhead percent) + context memory. The overhead and context values are yours. The 10 percent default is an example, not a measured figure.

Hugging Face Hub model pages list parameter counts, and GGUF files list their quantization in the file name. This tool does not read either for you.

> Estimate only. Check the memory your runtime reports before you buy hardware or download a large file.

## Questions

### Is this the exact memory a model will use?

No. It is an estimate. Real use depends on the runtime, the quantization format, the context length and the batch size. Load the model and read the memory your runtime reports.

### Where do I find bits per weight?

The model card or the GGUF file name names the quantization, such as Q4_K_M or Q8_0. Each format stores a little more than its name suggests because of scale values. The default of 4.8 bits matches the 0.6 bytes per parameter that this directory uses for its 4-bit size estimates.

### What is context memory?

The key-value cache grows with the context length. Its size depends on the model design. Read it from your runtime's log for the context length you plan to use, then enter it here.
