Free tool · checked against real runs
Ollama memory calculator for Mac
Pick a model, a context length and your Mac's memory to see how much memory Ollama will take and whether the model stays 100% on the GPU. The formula matches all 16 runs we measured with ollama ps on a 16 GB M4 Mac mini, with the default cache and with q8_0 and q4_0.
Will my PDF fit?
About 2,560 tokens. With your question and the answer, a 4K context holds it.
qwen3:4b at 32K on a 16 GB Mac
≈ 7.6 GB
100% GPU
- Weights
- 2.5 GB
- KV cache
- 4.8 GB
- Overhead
- 0.3 GB
Fits in the 11.5 GB macOS lets the GPU use, so the whole model runs on the GPU.
Measured with ollama ps on our 16 GB M4 Mac mini: 7.6 GB. See the test
How the calculator works
Ollama's memory is three parts:
memory ≈ weights + KV cache + overhead
KV cache = 2 × layers × KV heads × head size × bytes × context
overhead ≈ 0.1 GB + 5 KB × context
(+ 0.5 GB when the model is split with the CPU)Weights are the download size of the model's default tag. The KV cache holds the context, and Ollama reserves it for the whole window when the model loads, so it grows with the setting, not with your prompt. It takes 2 bytes a value by default (f16), about 1 with q8_0 and about half a byte with q4_0. Overhead is the compute buffer; we fitted it to our measurements. A model split between the GPU and the CPU needs a buffer on both, about 0.5 GB more.
The GPU limit is the share of memory macOS lets the GPU use by default: about two thirds on Macs with up to 36 GB, three quarters above. Whatever doesn't fit under it runs on the CPU, which is much slower. On our 16 GB Mac that limit is about 11 GB, which matches the GPU part of the splits ollama ps reported.
Gemma 3 is the exception. Most of its layers use a short sliding window, so its memory hardly grows with the context. For it the calculator shows what we measured.
Calculator vs. measured
Every run from our context-length and KV cache tests on an M4 Mac mini with 16 GB and Ollama 0.34.4, read from ollama ps. From 10 GB up it prints whole gigabytes, so 14 means 14.0 to 14.9. At 128K, the tests measured 49% on the GPU for qwen3:4b with f16, 81% with q8_0, and 61% for llama3.2:3b with f16.
| Model | KV cache | Context | Measured (GB) | Calculator (GB) | GPU (calc.) |
|---|---|---|---|---|---|
| qwen3:4b | f16 | 4K | 3.2 | 3.2 | 100% |
| qwen3:4b | f16 | 8K | 3.9 | 3.8 | 100% |
| qwen3:4b | f16 | 32K | 7.6 | 7.6 | 100% |
| qwen3:4b | f16 | 128K | 23 | 23.1 | 49% |
| qwen3:4b | q8_0 | 32K | 5.3 | 5.3 | 100% |
| qwen3:4b | q8_0 | 128K | 14 | 14.0 | 81% |
| qwen3:4b | q4_0 | 32K | 4.1 | 4.1 | 100% |
| qwen3:4b | q4_0 | 128K | 8.6 | 8.7 | 100% |
| llama3.2:3b | f16 | 4K | 2.5 | 2.6 | 100% |
| llama3.2:3b | f16 | 8K | 3 | 3.1 | 100% |
| llama3.2:3b | f16 | 32K | 6 | 6.0 | 100% |
| llama3.2:3b | f16 | 128K | 18 | 18.3 | 62% |
| llama3.2:3b | q8_0 | 32K | 4.3 | 4.3 | 100% |
| llama3.2:3b | q8_0 | 128K | 10 | 10.7 | 100% |
| llama3.2:3b | q4_0 | 32K | 3.3 | 3.3 | 100% |
| llama3.2:3b | q4_0 | 128K | 7 | 7.0 | 100% |
If the model spills to the CPU
- Lower the context length. 8K to 32K is plenty for most chats and documents. In the Ollama app it is under Settings › Context length; from the terminal, set
OLLAMA_CONTEXT_LENGTH; over the API, passnum_ctx. - Check it while it answers. Run
ollama ps. You want100% GPUin the PROCESSOR column. - Quantize the KV cache if you really need a long context:
OLLAMA_FLASH_ATTENTION=1andOLLAMA_KV_CACHE_TYPE=q8_0. It halved the cache with no loss in the answers we checked in our KV cache test. - Pick a model built for long context, such as gemma3:4b, which stayed at 3.5 GB and 100% GPU at 128K.
FAQ
How much memory do I need to run Ollama on a Mac?
The model's download size plus its KV cache, which grows with the context length. To stay fast it must fit under the GPU limit: about two thirds of memory on Macs with up to 36 GB, about 11 GB on a 16 GB Mac. There, 4B to 8B models fit at 8K to 32K, and 14B models only at short contexts such as 8K.
Why does a longer context use so much more memory?
Ollama reserves the KV cache for the whole context window when it loads the model, whether your prompt uses it or not. For qwen3:4b that is about 0.15 MB per token: 1.2 GB at 8K, 19 GB at 128K.
Is VRAM the same as RAM on a Mac?
Apple Silicon Macs have unified memory: the CPU and GPU share it. macOS lets the GPU use only part of it by default, so a model can spill onto the CPU before your memory is full. ollama ps shows the split in its PROCESSOR column.
Should I quantize the KV cache?
If you need a long context, q8_0 is the cheapest saving. Start Ollama with OLLAMA_FLASH_ATTENTION=1 and OLLAMA_KV_CACHE_TYPE=q8_0. In our test it halved the cache with no loss in our answer check: llama3.2:3b ran 128K fully on the GPU in 10 GB instead of 18 GB. q4_0 saved more, but qwen3:4b then got one fact wrong.
The tests behind it
Why Ollama is slow on a Mac: one setting has all 12 runs and the method. Ollama KV cache quantization on a Mac measures q8_0 and q4_0 and checks the answers. More model tests. We ran them in Creatos, the desktop app we make, which puts local and cloud models side by side on your own files.