Text Splitter for LLM
A 20,000-token text with a 8,000-token limit needs at least 3 parts (20,000 ÷ 8,000, rounded up), and a few more when paragraph and sentence ends leave gaps. Paste your text to see the real parts and their token counts.
How to use
- Paste the text. Pick a limit from the presets (common sizes or model context windows) or type your own, and set aside some tokens for your instructions and the reply.
- Turn on the Part header if you want each part to start with "Part 1/N", so the model and you keep the order straight.
- Copy the parts one by one, or download them all as one TXT file or a ZIP with a file per part.
How it works
Each part may hold at most the token limit minus the tokens you keep free. Tokens are counted in your browser with the o200k_base tables (the GPT-4o, GPT-4.1 and GPT-5 family) through js-tiktoken.
The text is cut at the largest natural boundary that fits: blank lines between paragraphs first, then single line breaks, then sentence ends (. ! ? and the CJK marks), then spaces between words. Neighbouring pieces are packed into a part until the next one would not fit, and the real token count of the joined text is checked.
With the Part header on, a line "Part i/N" and a blank line go in front of each part and count against the limit. Room for the longest header is set aside first, so no part goes over.
Only a word that is longer than the whole limit is cut in the middle, which can happen with long unbroken strings such as base64 or URLs. The tool reports how often.
ZIP files are written in your browser without compression, one TXT file per part.
FAQ
Why split a text for an LLM?
A prompt has to fit the context window together with the reply. When a text is too long, you can send it in parts with a header such as "Part 1/3" and ask the model to wait for all parts before it answers.
How do I use the Part headers?
Start with a message like: "I will send a long text in N parts. Reply only OK until I say I am done." Then paste the parts in order. The headers keep the order clear.
Is the token count exact for Claude or Gemini?
It is exact for OpenAI's o200k_base only. Claude and Gemini tokenize differently and publish no offline tokenizer, so their counts can differ. Use "Tokens to keep free" to leave a safety margin.
Do the parts overlap?
No. Parts follow each other without repeating text. If you need overlapping windows for retrieval, use the RAG Chunk Calculator.
Is my text uploaded?
No. Splitting, counting and the downloads all happen in your browser. The tokenizer table is downloaded from this site once.