Vector Storage Calculator: How Much Space Do Embeddings Need?
By FindMySum · Last reviewed
A vector storage calculator estimates how much disk or memory a collection of embeddings needs. Each embedding is a list of numbers, one per dimension, so the raw size is easy to work out; what catches people out is everything stored around it: metadata, the search index and extra copies. This page adds those up and shows the total in decimal GB or binary GiB. The worked example uses the defaults: one million 768-dimension float32 vectors with 200 bytes of metadata each and an HNSW index at M = 16.
The formula
bytes per vector = dimensions × bytes per number + metadata + index
total = vectors × bytes per vector × copies
| Precision | Bytes per number | Typical use |
|---|---|---|
| float32 | 4 | What most embedding models output |
| float16 / bfloat16 | 2 | Half the space, little quality loss |
| int8 | 1 | Scalar quantisation |
| binary | 1/8 (one bit) | Binary quantisation, often with re-ranking |
A binary vector is rounded up to whole bytes: 1,024 dimensions take 128 bytes.
Worked example
- Vector: 768 × 4 = 3,072 bytes.
- Metadata: 200 bytes (an ID, a source reference and a few filter fields).
- HNSW index: 2 × 16 × 4 + 4 + 8 = 140 bytes.
- Per vector: 3,072 + 200 + 140 = 3,412 bytes.
- Total: 1,000,000 × 3,412 = 3,412,000,000 bytes = 3.412 GB, or 3.18 GiB.
The vectors are 90% of it. Switch to int8 and each vector drops to 768 bytes, taking the total to about 1.11 GB; with binary quantisation the vector shrinks to 96 bytes, and metadata and the index become most of the size.
Where the HNSW figure comes from
HNSW (hierarchical navigable small world) is the graph index most vector databases use for fast approximate search. Each vector is linked to its nearest neighbours on several layers. In hnswlib, the reference implementation, every element reserves room on the bottom layer for up to 2 × M neighbour IDs of 4 bytes each, plus a 4-byte count and an 8-byte label: 8 × M + 12 bytes. The library's own notes put HNSW memory at roughly M × 8–10 bytes per element. Upper layers hold about one element in M, so they add a few percent more; the calculator leaves them out and says so. Other databases lay out their graphs differently, but the order of magnitude is the same.
A flat index stores nothing extra and compares the query with every vector, which is fine for a few hundred thousand vectors and slow beyond that.
Metadata is easy to underestimate
The vector is fixed by the model, but metadata is up to you. An ID and a URL are small; the original text chunk kept for display can be 2,000 bytes or more, which is bigger than a 384-dimension float32 vector. If your database stores the text alongside the vector, count it here.
GB, GiB and what you are sizing
Cloud object storage and disks are sold in decimal GB. RAM is built in binary units and many database dashboards report GiB, about 7% larger per unit. The calculator offers both as a labelled choice. For a server that keeps the HNSW graph in memory, size RAM from the GiB figure and leave headroom for queries and inserts.
Sizing a full system
Multiply by replicas for high availability, add backups, and remember that deletes often leave space behind until the database compacts its segments. If you also run the embedding model yourself, the VRAM calculator estimates its GPU memory, and the context window calculator shows how many retrieved chunks fit in each prompt.
More questions
How many vectors will my documents produce?
One per chunk. Divide each document's length in tokens by your chunk size (allowing for overlap) and add them up: 10,000 documents of 4,000 tokens in 500-token chunks with no overlap make 80,000 vectors. Images, products or users usually get one vector each.
Does reducing dimensions hurt search quality?
Somewhat, and how much depends on the model. Some embedding models are trained so their vectors can be shortened with little loss; others are not. Test recall on your own queries before and after, the same way you would test quantisation.
How much RAM does a vector database server need?
For an in-memory HNSW index, at least the vectors plus the index, with headroom for queries, inserts and the operating system: a common rule of thumb is to add 25–50% on top of this calculator's result. Disk-based indexes need much less RAM.
Do replicas double the storage bill?
Yes. Each replica is a full copy, so two replicas store twice the data and three store three times. Backups and snapshots are extra copies on top, usually on cheaper storage.
What is the M parameter in HNSW?
The number of links each vector gets to its nearest neighbours when it is added to the graph. Higher M improves recall on hard, high-dimensional data but costs memory (8 bytes per vector per unit of M in hnswlib's bottom layer) and build time. Values from 12 to 48 cover most uses.
Sources
- hnswlib: algorithm parameters and memory use (ALGO_PARAMS.md)
- hnswlib source: per-element memory layout (hnswalg.h)
- Malkov and Yashunin: Efficient and robust approximate nearest neighbor search using HNSW graphs (arXiv:1603.09320)
- sentence-transformers all-mpnet-base-v2 model card (768-dimension embeddings)
This article explains how the calculator works and is general information, not financial, tax, legal or medical advice. Rules change; check the sources above or a qualified professional before you act.