LLM Text Chunker
Sooner or later every long document meets a limit. The report is longer than the context window, the transcript will not paste into the chat in one go, the knowledge-base article needs to become embedding-sized pieces before a retrieval system can use it. At that point the document has to be chunked: cut into smaller, numbered pieces that each fit the limit, in order, without losing the thread of the text at the cuts.
This chunker does that cutting with the text’s own structure in mind. You set a size — in tokens or characters — and an overlap, and it packs whole paragraphs into each chunk until the next one would pass your limit. A paragraph too big to fit alone is packed from whole sentences; only a single sentence longer than the whole limit is cut mid-sentence, at the last boundary that fits. Each chunk comes back in its own card with its number, its token estimate, its character count and its own copy button, ready to paste one by one or take away all at once.
It is the third step in this hub’s developer chain. The LLM Token Counter measures a text, the LLM Context Window Calculator checks whether a whole prompt stack fits a model’s window — and this tool does the actual splitting when it doesn’t. All three use the same token estimator, so the number you measured in the first tool is the number the second tool checks against, and the number this tool cuts by. No re-counting surprises between steps.
LLM Text Chunker
Paste a long document and split it into numbered chunks that fit the limit you set — in tokens or characters. Paragraphs stay whole where they can, overlap between chunks is measured and labelled, and every chunk carries the same token estimate this hub’s other developer tools use.
How the splitting works. In paragraph-aware mode the text is first divided into paragraphs on blank lines. Whole paragraphs are packed into a chunk until the next one would pass your limit; a paragraph that is too big on its own is packed from whole sentences instead; and a single sentence that is still too big is cut at the limit, at the last token or character boundary that fits. Hard split mode skips the structure and cuts the whole text at the limit the same way. When overlap is set, each chunk after the first opens with the tail of the chunk before it — up to your overlap size, cut at a word boundary — and the chunk’s header says exactly how much overlap it carries, so repeated text is never a surprise. A chunk can therefore reach your size limit plus your overlap, and no more.
About the token numbers. Token counts here are estimates from the same counter this hub’s LLM Token Counter and LLM Context Window Calculator use: your text is split into words, numbers, symbols and whitespace runs, a word scores roughly one token per 4–5 letters, and the Claude-style figure is that base count × 1.2, matching published comparisons against Anthropic’s own counting tools. Chunk sizes in token mode are governed by the base estimate. On ordinary English prose the estimator usually lands within about ±20% of a provider’s official count; code, JSON, URLs and non-English text can miss by more, so leave headroom when a chunk has to fit a hard limit. Character counts are exact. Nothing is uploaded: your text is split locally in your browser.
How it works
The splitting runs in a fixed order, and it is deterministic — the same text with the same settings always produces the same chunks:
- Paragraphs first. The text is divided into paragraphs on blank lines, and single line breaks inside a paragraph are folded into spaces. Whole paragraphs are then packed greedily into a chunk: each paragraph joins the chunk if the result still fits the limit, and starts a new chunk when it wouldn’t.
- Sentences next. A paragraph that exceeds the limit on its own is split into sentences (on full stops, question marks and exclamation marks) and packed the same way, whole sentences at a time.
- A hard cut only when nothing else fits. A single sentence longer than the limit is cut at the limit itself — in token mode, at the last estimator boundary whose cumulative count fits, so the piece’s estimate is honest rather than hopeful; in character mode, at the exact character.
- Overlap, measured and labelled. When overlap is set above zero, each chunk after the first opens with the tail of the chunk before it — up to your overlap size, cut at a word boundary. The repeated amount is counted and printed in the chunk’s header (“includes ~20 tokens overlap from Chunk 1”), and a chunk’s total size can reach your limit plus your overlap, and no more.
If you’d rather ignore the text’s structure entirely, the Hard split at the limit preference cuts the whole document at the limit in one pass — useful for machine-consumed text where exact sizes matter more than readable breaks.
One honest note about the numbers, because it decides how much headroom to leave: the token counts are estimates from the same counter the hub’s Token Counter and Context Window Calculator use — words, numbers, symbols and whitespace runs scored by rules (roughly a token per 4–5 letters of a word, one per 3 digits, one per symbol), with a Claude-style figure at the base count × 1.2. That is not any provider’s official tokenizer, and on ordinary English prose it usually lands within about ±20% of an official count; code, JSON, URLs and non-English text can miss by more. Chunk sizes in token mode are governed by the base estimate, so if a chunk must fit a hard limit, size it with a margin. Character counts, by contrast, are exact. The sentence rule is simple too — an abbreviation like “Mr.” counts as a sentence boundary — which is why the paragraph-aware default keeps paragraphs whole first: most real documents never reach the sentence step at all.
How to use it
- Paste your text into the box. Its token estimates (base and Claude-style), character count and word count update as you type.
- Set the chunk size and pick the unit: Tokens when the chunks are headed for a model or an embedding pipeline, Characters when the destination counts characters — a paste limit or a fixed-size field. Switching the unit doesn’t convert the numbers, so glance at them after switching.
- Set the overlap: how much of each chunk repeats at the start of the next. Something in the region of a tenth to a fifth of the chunk size is a common working range; zero turns repetition off. It must be smaller than the chunk size, and the tool explains why if it isn’t.
- Leave the split preference on Keep paragraphs whole where possible for anything a person or a model will read in sequence; choose Hard split at the limit when the pieces are machine-consumed and exact sizes matter most.
- Press Split text. Changing any setting afterwards rebuilds the chunks straight away; if you edit the text itself, press Split text again.
- Copy chunks one at a time from their cards, use Copy all chunks to take the whole set with a visible separator between chunks, or Download .txt to save them with a numbered header on each chunk.
A worked example
Click Load the worked example and the tool loads a sample document — a community-garden newsletter piece of 394 words, 2,198 characters, about 510 tokens on the base estimate (about 612 on the Claude-style figure) — and sets the controls to 120 tokens per chunk, 20 tokens of overlap, paragraph-aware. These are the exact chunks it produces:
| Chunk | Tokens (base) | Tokens (Claude-style) | Characters | Opens with |
|---|---|---|---|---|
| 1 of 6 | ~83 | ~100 | 383 | “The community garden behind the library opened in the spring of twenty nineteen…” |
| 2 of 6 | ~113 | ~136 | 482 | “beds from donated timber and filled them with compost…” (includes ~20 tokens overlap from Chunk 1) |
| 3 of 6 | ~106 | ~127 | 444 | “fence is reserved for pumpkins and squash, which need more room…” (includes ~20 tokens overlap from Chunk 2) |
| 4 of 6 | ~110 | ~132 | 459 | “seedlings. The barrels empty fast in July…” (includes ~20 tokens overlap from Chunk 3) |
| 5 of 6 | ~101 | ~121 | 432 | “written guide. Coffee appears at ten…” (includes ~20 tokens overlap from Chunk 4) |
| 6 of 6 | ~97 | ~116 | 426 | “the food bank. Last year the table gave away…” (includes ~20 tokens overlap from Chunk 5) |
Two things worth noticing. First, each of the six paragraphs became its own chunk: the paragraphs measure roughly 77–93 tokens each, so any two together would pass the 120 limit — paragraph-aware packing keeps them separate rather than gluing two topics into one chunk to fill space. Second, every chunk after the first starts mid-flow on purpose: the overlap repeats the previous chunk’s closing words (Chunk 2 opens with the end of the first paragraph, “beds from donated timber…”), and the header tells you exactly how much of what you’re reading is repetition. Feed the chunks to a model in order and each one arrives with the tail of the previous thought still attached.
Who it is for
Developers preparing documents for embeddings and retrieval, who need numbered, evenly-bounded chunks with a stated overlap; builders feeding a long document to a model in sequence — summarise part by part, then summarise the summaries; anyone pasting a report, transcript or chapter into a chat tool that stops accepting text long before the document ends; and teams who already measure with this hub’s Token Counter or Context Window Calculator and want the splitter to use the same numbers they just checked.
Why use this tool
- Cuts at the text’s own joints — paragraphs stay whole, sentences stay whole, and a mid-sentence cut happens only when one sentence alone exceeds your limit, so chunks read cleanly in order.
- The same token numbers as the rest of the hub — one estimator across the Token Counter, the Context Window Calculator and this chunker, so measure → check → split is a single consistent workflow.
- Overlap you can see — the repeated text in every chunk is measured and labelled in its header, never silently baked in, so you always know how much of a chunk is new.
- Built for the paste-one-by-one workflow — numbered chunk cards with a copy button each, a copy-all with a visible separator, and a download with a header per chunk.
FAQ
What is text chunking for LLMs?
It’s cutting one long text into smaller pieces — chunks — so each piece fits a limit the whole text breaks: a model’s context window, a chat tool’s paste limit, or the input size an embedding model works best with. The chunks keep the original order, and with overlap set, neighbouring chunks share a little text so an idea that crosses a boundary keeps its context on both sides.
Should I split by tokens or by characters?
By tokens when the destination is a model. Context windows and embedding inputs are measured in tokens, so a token limit is the one your chunk actually has to respect — and this tool’s token estimate is the same one the hub’s Token Counter reports, so the two agree. By characters when the destination counts characters: a paste limit, a fixed-size field, or a platform cap. Character counts here are exact; token counts are estimates, so leave headroom under a hard token limit.
How much overlap should I use between chunks?
Enough to carry the end of one thought into the start of the next — a working range is roughly a tenth to a fifth of the chunk size (the worked example uses 20 tokens of overlap on 120-token chunks). More overlap means more repeated text to store, embed or read; less means boundaries land harder. If your chunks will be reassembled or read strictly in order and each paragraph already stands on its own, zero overlap is a perfectly good choice.
Are the token counts exact?
The character counts are exact; the token counts are estimates, and the tool says so wherever they appear. They come from the same estimator as this hub’s LLM Token Counter — a rule-based count that usually lands within about ±20% of a provider’s official tokenizer on English prose, and can miss by more on code, JSON, URLs or non-English text. For a chunk that must fit a hard limit, set the size a little under the limit and confirm close calls with the provider’s own counter.
Why do chunks come out smaller than my size limit?
Because paragraphs are packed whole. If the next paragraph would push the chunk past your limit, the chunk closes at its current size and the paragraph starts a fresh one — so a chunk of 83 tokens under a 120 limit is the splitter respecting a paragraph boundary, not wasting space. If you need chunks filled exactly to the limit regardless of structure, switch the split preference to Hard split at the limit.
Does my text get uploaded or stored anywhere?
No. The splitting runs entirely in your browser — the text is cut locally, nothing is sent to a server, and closing the tab discards everything. That’s worth having when the document is a contract, an internal report or anything else you wouldn’t paste into a third-party service.
What is text chunking for LLMs?
It’s cutting one long text into smaller pieces — chunks — so each piece fits a limit the whole text breaks: a model’s context window, a chat tool’s paste limit, or the input size an embedding model works best with. The chunks keep the original order, and with overlap set, neighbouring chunks share a little text so an idea that crosses a boundary keeps its context on both sides.
Should I split by tokens or by characters?
By tokens when the destination is a model. Context windows and embedding inputs are measured in tokens, so a token limit is the one your chunk actually has to respect — and this tool’s token estimate is the same one the hub’s Token Counter reports, so the two agree. By characters when the destination counts characters: a paste limit, a fixed-size field, or a platform cap. Character counts here are exact; token counts are estimates, so leave headroom under a hard token limit.
How much overlap should I use between chunks?
Enough to carry the end of one thought into the start of the next — a working range is roughly a tenth to a fifth of the chunk size (the worked example uses 20 tokens of overlap on 120-token chunks). More overlap means more repeated text to store, embed or read; less means boundaries land harder. If your chunks will be reassembled or read strictly in order and each paragraph already stands on its own, zero overlap is a perfectly good choice.
Are the token counts exact?
The character counts are exact; the token counts are estimates, and the tool says so wherever they appear. They come from the same estimator as this hub’s LLM Token Counter — a rule-based count that usually lands within about ±20% of a provider’s official tokenizer on English prose, and can miss by more on code, JSON, URLs or non-English text. For a chunk that must fit a hard limit, set the size a little under the limit and confirm close calls with the provider’s own counter.
Why do chunks come out smaller than my size limit?
Because paragraphs are packed whole. If the next paragraph would push the chunk past your limit, the chunk closes at its current size and the paragraph starts a fresh one — so a chunk of 83 tokens under a 120 limit is the splitter respecting a paragraph boundary, not wasting space. If you need chunks filled exactly to the limit regardless of structure, switch the split preference to Hard split at the limit.
Does my text get uploaded or stored anywhere?
No. The splitting runs entirely in your browser — the text is cut locally, nothing is sent to a server, and closing the tab discards everything. That’s worth having when the document is a contract, an internal report or anything else you wouldn’t paste into a third-party service.