Converter tool

Split Long Text to Fit a Context Window

Cut a long text into numbered parts sized by a token estimate to fit your budget, each topped with a note asking the model to wait for the rest. Copy the parts one by one or download them.

Each part may use the limit minus the reserve, 7,000 estimated tokens, and the part note counts inside that. Text is cut at paragraph breaks, then at sentence ends, then between words. Check your model's documented context window or message limit and leave some margin, because these counts are estimates.

{n} becomes the part number and {total} the number of parts. Put your actual question in the last note. Clear a note to leave it out.

The text is split by this tab and is not uploaded. Until you copy or download them, the text and the parts exist only in the tab's memory, and they are gone when you reload or close the page. A part goes to your clipboard only when you press its Copy button.

Preview

Output Preview

Paste text or choose a file, set the limit, then press Split text. Each part appears here with its own Copy button.

Split Long Text to Fit a Context Window

Operator: Abdulla Al Fahad. How tools are built and checked

Chat boxes and model APIs stop at a limit. Paste a long transcript or a book chapter and the app either refuses it or quietly keeps only part of it. Cutting the text by hand means guessing where 8,000 tokens ends, and a cut in the middle of a sentence hands the model a fragment. This tool does the cutting for you: choose the limit, how much room to keep for the reply, and the note that goes on top of each part, and it returns numbered parts sized by the site's token estimate to fit that budget, cut at paragraph breaks wherever it can.

Each part gets its own Copy button and is marked once copied, so you can paste them one at a time without losing your place. The default notes ask the model to answer only OK until the last part arrives. One limit is worth knowing before you start: parts sent into the same conversation all stay in that conversation's context. Splitting gets text past a per-message cap; it does not make a model's context window larger. The page adds the parts up and warns you when together they exceed the limit you chose.

Key features

  • Limit presets of 4,000, 8,000, 32,000 and 128,000 estimated tokens, or any custom limit
  • Reply reserve subtracted from the limit, with the part note counted inside each part
  • Cuts at paragraph breaks first, then at sentence ends, then between words
  • Editable notes for the middle parts and the last part, with {n} and {total} filled in
  • Optional overlap that repeats the last words of one part at the start of the next
  • Copy button per part, with copied parts marked so you can keep your place
  • ZIP of numbered part files, or every part in one text file with separator lines
  • Warning when the parts together come to more than the chosen limit

The token budget and how parts are packaged

Input is a .txt or .md file of up to 10 MB, or text pasted into the box. A file opening with a UTF-16 byte-order mark is decoded as UTF-16 and any other as UTF-8. If the bytes break the UTF-8 rules, the splitter decodes them with the Windows-1252 table instead and says so under the file name, so you can check accented letters before pasting any part. Line breaks are kept as they are.

The limit comes from a preset (4,000, 8,000, 32,000 or 128,000 estimated tokens) or a custom number from 100 to 2,000,000. The reserve for the reply is subtracted from it, and what remains is the budget every part must stay within. The note at the top of a part counts against that budget, since it is pasted along with the text.

Every part is the filled-in note, a blank line, then the text. The ZIP holds part-01.txt, part-02.txt and so on, with three-digit numbers from 100 parts upward so the files sort in order. The single-file download holds every part, each after a line such as ===== Part 2 of 5 =====. Both are UTF-8 text.

Each part lists its estimated size with a low-to-high range beside it, along with its length in characters. The model's own tokenizer may count the same part differently.

How it works

The text is first split at blank lines into paragraphs. A paragraph that fits the budget on its own is never cut. One that does not fit is cut after a run of . ! ? or … (plus any closing quotes or brackets) that has whitespace after it, or after 。!?. This rule does not know abbreviations, so when a paragraph must be broken a cut can land after "Dr." or "e.g.". A sentence that still does not fit is cut at spaces. Only a run of characters with no spaces at all that is longer than a whole part, such as a pasted block of encoded data, is cut mid-run, and the page reports how many parts contain such a cut.

Parts are then filled in order: each takes as many whole paragraphs, or pieces of an oversized paragraph, as fit. Fit is checked on the exact text that would be pasted, blank lines included, using the token estimate, so the estimate shown for a part is the same one used to build it.

The note's size depends on how many digits the part numbers have, so the tool first works out the note cost for the widest numbers it might need, splits, and then redoes the split if the total turns out to need another digit. Finally each finished part, note included, is measured again; if any part is over the budget, the text budget is tightened and the split repeated.

With overlap switched on, the start of each part after the first repeats the longest run of whole words from the end of the previous part that stays within the overlap size. The overlap counts toward the budget like everything else, and it is shortened when the next paragraph needs the room.

Common use cases

  • Pasting a long interview transcript into a chat assistant whose message box rejects text past a certain length
  • Sending a book chapter to a model in several messages and asking for a summary only after the last one
  • Cutting a long report into parts to summarise one by one in separate requests, then combining the summaries
  • Preparing numbered part files for a script that sends each one to an API in turn
  • Checking roughly how many tokens a document is before deciding which model to use

How to use this tool

  1. Paste the text or choose a .txt or .md file. Press Use sample text to see a short set of meeting minutes split into two parts.
  2. Pick a token limit that matches the limit of the chat or API you are pasting into, then set a reserve for the reply.
  3. Edit the two notes if you like. Put your actual question or task into the last-part note so it arrives with the final piece of text.
  4. Press Split text and check the summary: the number of parts, the total, and any warning about the total or about cuts inside long runs of characters.
  5. Copy part 1, paste it, wait for the reply, then come back for part 2. Copied parts are marked.
  6. If you prefer files, download the ZIP of numbered parts or the single text file instead.

Example

The page's sample: board meeting minutes, 8 paragraphs, 217 words, about 307 estimated tokens, with a custom limit of 300 and no reserve

Board meeting, 14 March. Present: Okafor (chair), Lindqvist, Haddad, Moreau, Tanaka. Apologies: Brennan.

1. Minutes of the February meeting were approved without changes. ...

(items 2 to 5)

6. Any other business. Tanaka raised the broken lock on the side gate. It will be replaced this month from the maintenance budget.

Next meeting: 9 May, 7 pm, in the small hall.

2 parts, each within 300 estimated tokens

Part 1 of 2: about 281 tokens (225 to 341), the attendance line and items 1 to 5
This is part 1 of 2. Reply only OK until I send the last part.

Board meeting, 14 March. Present: Okafor (chair), ...
...Tuesday evenings still need cover; Moreau will put a notice in the newsletter.

Part 2 of 2: about 72 tokens (59 to 85), item 6 and the next meeting date
This is part 2 of 2, the last part. You now have the whole text, so please answer my request about it.

6. Any other business. Tanaka raised the broken lock on the side gate. ...

Next meeting: 9 May, 7 pm, in the small hall.

Tips for best results

  • Set the limit below the real one. The counts are estimates rather than your model's tokenizer output, and a chat app may count its own instructions and your earlier messages against the same window.
  • Write the last-part note as the real request, for example "This is part {n} of {total}, the last part. List every decision and who owns it." The model then sees the task right after the final text.
  • If the model starts answering before the last part, send a short reminder that more is coming; a note is only a request, and a model may not follow it.
  • Turn overlap on only when parts are handled in separate requests. In a single conversation the model already has the previous part, and overlap just repeats text.
  • Clear both notes when you only need the raw pieces, for example to feed a script that adds its own wrapper.
  • Separate topics in your source with blank lines before splitting; paragraph breaks are the tool's preferred cutting points.

Common pitfalls

Every part pasted into one conversation stays in its context. If the parts add up to more than the model's window, the earliest parts can be dropped or the app may refuse to continue, whatever the size of each part. The amber warning on the page is there for this case.

The limit is in estimated tokens. A model's tokenizer may split your text, for example code, tables of numbers or another language, into more pieces than the estimate assumes, and then treats a part as larger than the number shown.

Markdown structure is not considered. A fenced code block or a table that contains blank lines can be cut at one of them, and one with no blank lines is cut at sentence ends or spaces if it is longer than a whole part.

Text with no blank lines at all, such as a transcript saved with one line per speaker turn, is treated as one huge paragraph and cut at sentence ends, so a part may end in the middle of a speaker turn.

This tool reads text files only. A PDF or Word file is refused with a message; copy its text and paste it, or use the Text Chunker for RAG, which reads both.

Common errors and how to fix them

"The reply reserve of 1,000 leaves only 0 tokens per part."
The reserve is as large as the limit, which happens when you switch to a small custom limit and keep the default reserve. Lower the reserve or raise the limit so at least 100 tokens remain.
"Keep the overlap under half of the 7,000 tokens each part can hold…"
An overlap that large would make every part mostly repeated text. Use a much smaller overlap, or 0 if the parts go into one conversation.
"The part notes take about … of the … tokens each part can hold, leaving too little room for text."
The notes are long compared with the budget. Shorten them, lower the reserve or raise the limit.
"This would make more than 5,000 parts."
The limit is very small for a file this long. Raise the token limit or lower the reply reserve so each part holds more text.
"… is a PDF. This splitter takes plain text…"
Copy the text out of the PDF and paste it into the box, or load the PDF into the Text Chunker for RAG, which reads PDF text layers.

Best practices

  • Look up the context window or message limit in your model's or app's own documentation at the time you use it, and set the limit below it.
  • Keep the reserve generous when you expect a long answer, such as a full summary or a rewritten document.
  • Send parts in order and do not skip numbers; the notes tell the model how many parts to expect.
  • For texts far larger than the window, summarise each part in its own request and then ask for a summary of the summaries.
  • Keep the ZIP or the single file until you have the answer, so a part can be re-sent if the conversation is interrupted.

Working out the limit and the reserve

Suppose your model's documentation gives a 32,000-token window and you expect a reply of up to about 2,000 tokens. Choose the 32,000 preset and a 2,000 reserve, and each part may use 30,000 estimated tokens, the note included. A transcript estimated at 75,000 tokens then needs at least three parts.

The same three parts pasted into one conversation add up to about 75,000 tokens, far more than the 32,000-token window, and the page shows its warning. Here the right approach is separate requests: summarise each part on its own, then combine the three summaries in a fourth request. If instead the obstacle is a chat box that rejects long messages, set the limit to that message cap, and make sure the total still fits the model's window.

Writing the part notes

The default middle note asks for nothing but OK, so when the model complies, the replies between parts stay short and use little of the context. Keeping {n} and {total} in both notes tells the model how many parts to expect. Whether it actually waits is up to the model, so read each reply before you send the next part.

Notes are not limited to English. Write them in the language of the conversation, and if your text is a translation job or a list to process, say so in the last note instead of in a separate message afterwards.

Frequently asked questions

Does splitting let a model read more than its context window?

Not in one conversation. All parts remain in the context, so their total still has to fit. Splitting helps with per-message limits, or with handling each part in its own request.

What if the chat still says a part is too long?

Lower the token limit or raise the reserve, press Split text again and start over from part 1. Parts are sized by an estimate that can come out below the count your model or app uses, and some apps also count their own instructions and earlier messages against the limit.

Is the long text uploaded while it is split?

No. Splitting runs in this browser tab and the text is not uploaded. Until you copy or download them, the text and the parts exist only in the tab's memory and are gone when you reload or close the page; a part reaches your clipboard only when you press its Copy button.

Why are the files called part-01.txt rather than part-1.txt?

The leading zero keeps part-10.txt from sorting before part-2.txt in file managers. From 100 parts upward the numbers get three digits for the same reason.