RAG chunk size & embedding cost calculator

Smaller RAG chunks (256 tokens) boost retrieval precision but multiply vector count, HNSW RAM footprint, and embedding API bills by 4× compared to 1,024-token chunks — and high overlap (20%–30%) compounds the inflation further. Sweep chunk sizes from 128 to 2,048 tokens below.

Interactive calculator

Chunk Size SweepTotal ChunksEmbedded TokensInitial Embed $HNSW RAM (GB)Est. Vector DB / Mo

Frequently asked questions

What is the best chunk size for RAG in 2026?

For general technical documentation and knowledge bases, 512 tokens with 10%-15% overlap is the strongest starting point. Use 256 tokens for short factoid lookup and 1024 tokens (or parent-child retrieval) for legal, code, and narrative documents.

How does chunk overlap affect embedding cost and vector DB size?

A 20% overlap shrinks your effective stride to 80% of the chunk size, increasing both total chunks and total embedded tokens by 25% (1 / 0.80). Keeping overlap at 10%-15% preserves boundary context without inflating RAM.

How much RAM does an HNSW vector index need?

For FP32 1536-dim vectors, raw vectors take ~6 KB per chunk and HNSW graph links + metadata add ~1.5x overhead (~9 KB/chunk, or ~9 GB per 1 million chunks). Switching to INT8 scalar quantization cuts vector RAM by ~70% with <1% recall loss.

Should I use text-embedding-3-small or text-embedding-3-large?

text-embedding-3-small ($0.02/1M, 1536d) is 6.5x cheaper to embed and uses half the vector RAM of text-embedding-3-large ($0.13/1M, 3072d). If you use 3-large, Matryoshka dimension reduction to 1024 dims recovers most of the RAM savings.

How do I estimate monthly vector database hosting cost?

Managed vector stores (Pinecone, Qdrant Cloud, Turbopuffer, pgvector) scale primarily with active RAM/storage (~$12-$25/GB-month for hot HNSW RAM). Quantizing vectors to INT8 or binary is the fastest way to cut monthly vector DB bills.

All calculations run locally in your browser. HNSW RAM includes a 1.5x graph + payload overhead factor; managed vector DB pricing uses a $16/GB-month hot-RAM planning baseline.