RAG Document Chunking & Embedding Cost Calculator
Compute total vector chunk counts, overlap token inflation, initial embedding API cost, and annual re-indexing spend.
Input Parameters
Calculated Output
Primary Result
—
Adjust inputs to recalculate immediately.
500 MiB Text Corpus Ingestion Scaling (512-Token Chunks, 15% Overlap)
Small changes in overlap or chunk size multiply both embedding costs and downstream Vector DB vector count.
| Embedding Model / Rate | Effective Tokens | Total Chunks | Initial Ingestion | Annual Cost (4x Re-Index) |
|---|---|---|---|---|
| Local Open-Source (BGE-M3 / Nomic) | 154.2M tok | 301,179 chunks | $0.00 (GPU time) | $0.00 API fees |
| text-embedding-3-small ($0.02/1M) | 154.2M tok | 301,179 chunks | $3.08 | $15.42 / yr |
| text-embedding-3-large ($0.13/1M) | 154.2M tok | 301,179 chunks | $20.05 | $100.23 / yr |
Formula & Engineering Methodology
Assumes ~4 bytes per token for clean UTF-8 English/Markdown text. Chunk stride shrinks by (1 - overlap_pct), inflating both billed tokens and stored vectors.
raw_tokens = (corpus_mb * 1048576) / 4
effective_tokens = raw_tokens / (1 - (overlap_pct / 100))
total_chunks = ceil(effective_tokens / chunk_size_tok)
initial_cost = (effective_tokens / 1e6) * embed_price_per_m
annual_cost = initial_cost * (1 + re_index_per_year)
Variable Definitions
4 bytes/tok: Average byte-to-token ratio for English/technical documentation.1 - overlap_pct: Effective step stride across overlapping sliding windows.
Practical Note: Store extracted plain text separately from raw PDFs/HTML—raw binary PDF sizes are often 5x–15x larger than their actual extractable text bytes.
Frequently Asked Questions
Why does 15–20% chunk overlap affect Vector DB sizing as well as API bills?
Overlap duplicates boundary sentences into extra chunks; 25% overlap expands both total embedded tokens and stored vector count by 33%.
When do local BGE or Nomic embeddings beat cloud APIs?
If you ingest sensitive corporate documents, re-index nightly across gigabytes of logs, or already run a local GPU, self-hosting BGE-M3/Nomic removes API latency and vendor lock-in.
How can I avoid paying full embedding fees when documents update?
Hash individual document chunks (SHA-256) before embedding so incremental pipeline runs only re-embed changed sections instead of the entire corpus.