RAG Text Chunking Calculator

Paste a long document, set chunk size and overlap, and see it split locally by estimated token count, with the character count, estimated tokens and a content preview for every chunk - handy for tuning RAG chunking strategy.

FreeOnline Tool
Loading…

How to Use

  1. Paste the long text you want to split into the "Input text" area.
  2. Set the chunk size, measured in tokens - pick one of the 256 / 512 / 1024 / 2048 presets, or choose "Custom..." and type your own token count.
  3. Set the overlap as a percentage of the chunk size (up to 90%), which is how much repeated content neighbouring chunks share.
  4. The page shows the total chunk count, average characters per chunk and average estimated tokens per chunk in real time, and lists each chunk below with its character count, estimated tokens and a content preview.
  5. Press "Load sample text" to try it on a sample passage about RAG.

Features

  • Chunk size is expressed in tokens, with 256/512/1024/2048 presets plus a custom token count option.
  • Overlap is set as a percentage of the chunk size (capped at 90%, so an excessive overlap cannot break the split).
  • Before splitting, the tool estimates the character-to-token ratio of your text (about 1.7 characters per token for CJK characters, about 4 for everything else) and uses it to convert the token-based settings into character positions for a sliding-window split, so mixed Chinese-English text still chunks sensibly.
  • Each chunk is listed with its character count, estimated token count and a preview (long content is truncated), alongside summary totals for chunk count and averages.
  • Pure local JavaScript - your text is never uploaded.
  • A "Load sample text" button for a quick trial.

Use Cases

Tuning RAG chunking strategy
Before building a vector knowledge base, try different chunk size and overlap combinations and judge the balance between semantic completeness and retrieval precision.
Reviewing long document preprocessing
Preview how manuals, contracts and other long documents break apart, so you can design the document pipeline around the real size distribution.
Estimating vector database volume
Work out how many chunks a corpus produces to help forecast vector storage and the cost of embedding calls.
Comparing overlap settings
Adjust the overlap percentage to see directly how chunk count and content repetition change compared with a non-overlapping split.

FAQ

Are the token counts used for splitting exact?
No. The tool approximates the character-to-token ratio (about 1.7 characters per token for CJK characters and about 4 for everything else) and then splits by character position. It does not cut on real tokenizer boundaries, so results may differ from your model's official tokenizer.
Does it respect sentence or paragraph boundaries?
No. The current implementation is a plain character-level sliding window with no semantic or sentence-boundary optimization. Splitting by sentence or paragraph requires preprocessing the text yourself.
What is the maximum overlap?
90%. A very high overlap sharply inflates the number of chunks and makes them highly repetitive, so any value above 90% is clamped back to 90%.
What units do chunk size and overlap use?
Chunk size is in estimated tokens (512 means roughly 512 tokens). Overlap is a percentage of the chunk size, so 10% of a 512-token chunk is an overlap of roughly 51.2 tokens.