Splitting text is an information-design problem
The easiest way to divide a long document is to cut every fixed number of characters. It is also the easiest way to break a definition from its example, a table header from its rows, a speaker label from the sentence that follows, or a conclusion from the evidence it summarizes.
A good split preserves enough local meaning that each chunk can be read, copied, processed, or resumed without reconstructing the original document from memory. That requires decisions about boundaries, size, overlap, labels, sequence, and what the receiving system will do with the chunks.
Know what limit you are actually solving
“Too long” can describe different constraints: a message-character limit, a model context window, a file-upload limit, a database field, a social post, an email client, or a human reader’s attention. These are not interchangeable.
| Destination | Measure | Practical implication |
|---|---|---|
| Messaging/social platform | Characters | Count exact characters including labels and continuation text. |
| Language model | Tokens | Reserve room for instructions, prior conversation, tool output, and the model’s answer. |
| File upload | Bytes/pages/tokens | The system may index or retrieve only parts instead of loading the whole file into context. |
| Database/API field | Characters or bytes | Encoding and escaping may change the actual payload size. |
| Human review | Sections/time | Smaller logical units can improve accountability even when no technical limit exists. |
OpenAI’s tokenizer notes that English text often averages roughly four characters per token, but it is only a rule of thumb. Code, URLs, numbers, non-English text, and unusual formatting tokenize differently. When a token limit matters, measure tokens or keep a safety margin rather than converting characters with false precision.
Choose semantic boundaries in a clear order
Use a hierarchy. Try the strongest boundary first; fall back only when the unit is still too large.
- Document or chapter boundary.
- Heading and its section.
- Paragraph.
- List item, dialogue turn, table row group, or code block.
- Sentence.
- Clause or hard character/token cut as the final fallback.
Never split a fenced code block, HTML tag pair, Markdown table, citation block, or numbered procedure blindly. Treat those structures as atomic when possible. If one atomic unit exceeds the limit, add a structure-specific rule—for example, repeat the table header in every chunk or divide code at function boundaries.
Set chunk size from the receiving workflow
A chunk should be small enough to fit with its metadata and any response, but large enough to avoid excessive fragmentation. There is no universal optimum.
For manual message transfer
Use a target below the platform limit so labels and accidental edits do not overflow. A 4,000-character limit might justify 3,500–3,700 characters, not 3,999.
For AI analysis
Reserve space for the system instructions, your task, conversation history, retrieved material, and the model’s answer. A model accepting a large context does not mean every token should be filled with source text. Research on long-context use found that relevant information can be harder to use when buried in the middle, even for models designed for long inputs.
For retrieval or indexing
Smaller chunks improve precision but may lose relationships; larger chunks preserve context but retrieve more irrelevant material. Start with logical sections and evaluate on real questions rather than copying a default size from a tutorial.
Use overlap only to carry dependencies
Overlap repeats material from the end of one chunk at the beginning of the next. It can preserve a sentence, definition, speaker, or transition that would otherwise become ambiguous. Too much overlap wastes context and can cause duplicate summaries, counts, or extracted records.
Use structural overlap when possible:
- Repeat the heading and one-sentence section purpose.
- Repeat the last complete sentence when a paragraph is cut.
- Repeat table headers, not arbitrary rows.
- Repeat the active speaker and timestamp in transcripts.
- Repeat function/class signature when code continuation is necessary.
For ordinary prose, a small overlap—often one or two sentences—is usually more interpretable than a blind percentage. Label repeated text if the downstream task could count it twice.
Number every chunk and include a transfer manifest
Numbering makes missing parts visible and allows a conversation or workflow to resume after interruption. Use both the current position and total count:
[DOCUMENT: Customer research notes]
[CHUNK: 03/12]
[SECTION: Cancellation reasons]
[CONTINUES FROM: Chunk 02]
[INSTRUCTION: Store this part. Do not analyze until CHUNK 12/12.]
A manifest should identify the document, chunk count, order, purpose, and processing rule. For higher-stakes transfers, include a short checksum or character count for each part so accidental edits can be detected.
At the end, send a completion message that states the final chunk number and the task to perform. Do not rely on “that is all” without a known expected total.
Design for resumability
A resumable chunk can be understood even if the receiver no longer has perfect access to the earlier exchange. Include stable identifiers and state.
- Document ID and version.
- Chunk number and total.
- Current section heading.
- Whether text is original, repeated overlap, or a continuation.
- What has already been completed.
- What should happen after the final chunk.
For long AI sessions, ask for an ingestion acknowledgement after every batch: received chunk IDs, missing IDs, and no analysis yet. If the session breaks, restart with the manifest and the last confirmed chunk instead of resending everything.
Handle special content types deliberately
Tables
Repeat column headers in every part. Do not separate footnotes, units, or legends from the rows they govern. Preserve row identifiers so results can be merged.
Code and configuration
Split at file, class, function, or top-level block boundaries. Include the filename and language. Keep imports and configuration dependencies visible. Do not let overlap create duplicate executable statements.
Transcripts
Split at speaker turns or topic changes. Repeat the speaker name, timestamp range, meeting ID, and active agenda item.
Research and citations
Keep citations with the claims they support. Carry section-level bibliography keys or URLs into the chunk. If references are centralized, include a stable citation identifier that can be resolved later.
Legal or policy documents
Preserve section numbers, defined terms, exceptions, and cross-references. A chunk that contains “except as provided in Section 8” is not self-contained unless Section 8 remains addressable.
Why a large context window does not eliminate chunking
Long-context models can accept more text, but input capacity is not the same as reliable retrieval and reasoning over every position. The “Lost in the Middle” study found that performance was often strongest when relevant information appeared near the beginning or end and weaker when it appeared in the middle.
Chunking can improve the workflow by making retrieval explicit, reducing irrelevant context, placing the task close to the relevant text, and enabling intermediate checks. It also makes failures recoverable: one malformed part can be resent without rebuilding the entire conversation.
The goal is not always to make chunks tiny. It is to build a context architecture in which the model sees the right material at the right step.
A practical chunking algorithm
A dependable splitter should make boundary decisions in a predictable order rather than cut at the first character limit. The following process works for manual transfer, AI analysis, and resumable document review.
- Normalize the input: standardize line endings, remove accidental repeated blank lines, and preserve meaningful indentation.
- Protect atomic blocks: mark code fences, tables, quotations, citations, list items, and headings that should not be cut internally.
- Create semantic units: split first at section headings, then paragraphs, then sentences, and only then at words or hard characters.
- Pack units up to the target: add the next complete unit only when it fits inside the usable budget after labels and overlap.
- Handle oversized units deliberately: a huge paragraph may need sentence-level splitting; a huge code block may need a different transfer method rather than arbitrary truncation.
- Add dependency overlap: copy only the minimum prior material needed to interpret the next chunk.
- Label and hash the sequence: include document ID, chunk number, total chunks, and optionally a short checksum or first/last-line marker.
- Produce a manifest: record the original size, chunk rule, target, overlap, and any protected block that required special handling.
This process is greedy—it fills a chunk until the next semantic unit would exceed the budget—but the hierarchy prevents the common failure where a heading is separated from its first paragraph or a citation is detached from the claim it supports.
Carry a state packet when analysis spans multiple messages
For sequential AI work, each chunk should not merely contain source text. It should arrive with a compact state packet that tells the model where the work stands. A useful packet contains the document ID, current chunk, task, approved terminology, open questions, and the format of the running output.
DOCUMENT: policy-review-2026-08
CHUNK: 4 of 11
TASK: identify obligations, deadlines, and ambiguous clauses
APPROVED TERMS: customer, provider, service period
RUNNING OUTPUT: append rows to the obligation table
OPEN QUESTIONS: whether section 8 overrides section 3
INSTRUCTION: acknowledge receipt; do not finalize until chunk 11
After each chunk, ask for a short structured checkpoint rather than a fresh prose summary. For example: facts added, unresolved dependencies, terms introduced, and the last completed source heading. That checkpoint can be pasted into the next state packet and used to resume after an interruption.
Do not let the running summary grow without limit. Periodically compress it into stable decisions and unresolved items, then discard superseded narration. Otherwise the summary becomes another long document competing with the source for context.
Test the split before trusting it
A splitter should be tested like a transformation pipeline. Reassemble the chunks after removing labels and deliberate overlap, then compare the result with the normalized source. The text should be complete, ordered, and free of accidental duplication. Separately inspect the boundaries because a byte-for-byte reassembly test can pass even when the chunks are unpleasant to read.
| Check | Question | Failure signal |
|---|---|---|
| Coverage | Can the normalized source be reconstructed? | Missing sentence, table row, code line, or citation |
| Order | Are chunks and internal units in source order? | Numbering gap or paragraph inversion |
| Boundary quality | Does each chunk begin and end at an intelligible point? | Heading alone, sentence fragment, split list item |
| Overlap | Is repeated material necessary and clearly marked? | Large duplicated sections or contradictory summaries |
| Budget | Do labels, overlap, and content all fit? | Receiving system truncates the final lines |
| Resumption | Can work restart from any chunk? | No document ID, chunk count, or prior-state checkpoint |
Use the Jivaro Long Text & Message Splitter
The Long Text & Message Splitter creates numbered, copy-ready chunks in the browser. Use it when a document, prompt, email, thread, or message exceeds the destination limit.
- Paste the original text and keep an untouched copy.
- Enter a target character limit below the destination’s hard maximum.
- Choose labels and numbering so every part identifies itself.
- Enable overlap only when the text needs continuation context.
- Review boundaries around headings, tables, code, and citations.
- Copy chunks in order and confirm receipt.
- Send the final processing instruction only after the last chunk.
Recommended patterns
| Use case | Pattern |
|---|---|
| AI document analysis | Manifest + section-based chunks + instruction to wait + final synthesis request. |
| Chat or social message | Character-safe chunks + 1/N labels + no overlap unless a sentence is cut. |
| Transcript | Topic/speaker boundaries + timestamp range + repeated active agenda item. |
| Table | Repeat header and units + stable row IDs + no duplicate data rows. |
| Code | File/function boundaries + filename/language + dependency note. |
| Multi-session project | Document/version ID + chunk manifest + receipt ledger + resume pointer. |
Final chunking checklist
- Measure the actual destination limit.
- Reserve room for labels, instructions, and output.
- Prefer headings and paragraphs over hard cuts.
- Use the smallest useful overlap.
- Number chunks and state the total.
- Preserve tables, code, citations, speakers, and defined terms.
- Tell the receiver whether to wait or act.
- Confirm every part was received.
- Keep an untouched original.
- Test the workflow on a representative document before using it at scale.
Good chunking makes order, context, and recovery explicit. It turns “paste this somehow” into a controlled transfer protocol.
Frequently asked questions
Use the largest chunk that reliably fits the destination after reserving room for labels, instructions, conversation history, and the response. There is no universal size.
Use only enough to carry a dependency—often a heading and one or two sentences. Excess overlap wastes context and can create duplicate counts or summaries.
Use characters when the destination enforces a character limit. Use tokens when a model context limit matters, and keep a safety margin because tokenization varies by language and content type.
No. Capacity does not guarantee equal use of every position, and chunking still improves retrieval, sequencing, verification, and failure recovery.
Send a manifest, number each part, tell the model not to analyze until the final part, confirm received IDs, and issue the final task only after the complete set is acknowledged.
Related Jivaro apps
Split long text into copy-ready chunks for X, Discord, Telegram, SMS, and AI prompts using grapheme-safe character limits or token-aware overlap.
Open appSources and references
- Lost in the Middle: How Language Models Use Long ContextsarXiv · primary · Accessed 2026-08-01
- OpenAI TokenizerOpenAI · primary · Accessed 2026-08-01
- Long Text & Message SplitterJivaro · first-party · Accessed 2026-08-01

