Stop Sequence Tester
See where an LLM stop sequence would cut generated text. Paste text, list stop sequences, watch the kept and discarded parts live. Free, in-browser.
Stop Sequence Tester
The model's raw output, before any stop sequence is applied.
One per line. Matching is case-sensitive, like real APIs.
How to Use the Stop Sequence Tester
Paste the generated text
Drop in the model's raw output — the full completion you would get back before any stop sequence is applied. The sample text is editable, so replace it with your own.
List your stop sequences
Enter one stop sequence per line in the right-hand box, exactly as you would send them in an API call. Matching is case-sensitive, so END and end are treated as different strings.
Read the live preview
The kept portion — everything before the earliest match — stays in normal colour. From the matched sequence onward, the text is dimmed and struck through to show what the API would discard.
Check the status line
The status reports which stop sequence matched and at what character index, or tells you that no sequence matched and the full text is kept. Tune your sequences until the cut lands where you want it.
Stop Sequences: The Trip-Wire That Ends a Completion
What a stop sequence actually does
When you call a large-language-model API — OpenAI, Anthropic's Claude, Google's Gemini, or an open model behind a server — you can pass a list of stop sequences (sometimes called stop tokens or stop strings). A stop sequence is a short piece of text that tells the model: "the moment you are about to produce this string, halt." Generation stops, and — this is the crucial part — the stop string itself and everything that would have come after it are not returned to you. The response you receive is the text generated up to but not including the trigger. That is exactly what this tester visualises: the kept portion in normal colour, and the discarded portion, from the match onward, dimmed and struck through.
Internally, models generate text token by token, and a stop sequence is checked against the growing output as it streams. The instant the running text would contain a stop string, the server cuts generation and trims the response back to the boundary. Because the check is on the literal characters, matching is case-sensitive and whitespace-exact: a stop sequence of Question: will not fire on question:, and a sequence of two newlines only fires when two real newlines appear back to back. Most APIs let you supply several stop sequences at once, and the one that ends the completion is whichever one would appear earliest in the text — which is the rule this tool uses when it scans across every sequence you list and reports the first cut.
"A stop sequence is not a suggestion to the model — it is a hard boundary applied to the output. The text after it never reaches you."
Why people reach for stop sequences
Stop sequences are one of the most practical controls in prompt engineering, and they solve very concrete problems. The classic use is chat and role formatting: if you prompt a model with a transcript that uses labels like User: and Assistant:, you set User: as a stop sequence so the model writes the assistant's turn and halts before it starts hallucinating the user's next line. A second common use is structured output: when you ask for a single JSON object or one list item, a stop sequence on a closing delimiter or a blank line keeps the model from rambling on with a second object or a chatty explanation. A third is cost and latency control — every token after the point you care about is wasted money and time, so a well-placed stop sequence trims the tail before it is ever generated.
There are pitfalls worth knowing. Because the stop string is removed from the output, you sometimes need to add it back yourself if your downstream parser expects it — for example, re-appending a closing brace that you used as the stop. A stop sequence that is too generic (a single space, a lone period) can cut the completion almost immediately and leave you with an empty or truncated answer; the live preview here makes that failure obvious at a glance. And remember that a stop sequence only acts on the model's output — it has no effect on your prompt, and it will not fire on text that the model never reaches. Use this tester to rehearse a stop sequence against a representative completion before you wire it into production: paste the kind of text your model produces, list the sequences you plan to send, and confirm the cut lands precisely where your application needs it.
10 Facts About Stop Sequences
A stop sequence tells the model to halt generation the moment it would produce that string.
The stop string itself is removed from the response — you get the text up to, but not including, the trigger.
Matching is case-sensitive: END and end are different stop sequences.
When several stop sequences are supplied, the one that fires is whichever appears earliest in the output.
A favourite use is chat formatting — set User: as a stop so the model never writes the user's next turn.
Stop sequences help produce clean structured output, cutting a completion right after one JSON object or list item.
They save tokens: text trimmed by a stop is never generated, so it costs nothing in money or latency.
A stop sequence only acts on the model's output — it has no effect on your prompt.
Too-generic stops (a space or a lone period) can cut the answer almost immediately — a common bug.
This tester runs entirely in your browser — your text and sequences are never uploaded.
Frequently Asked Questions
- A stop sequence is a short string you pass to an LLM API that tells the model to stop generating the instant it would produce that string. The stop string and everything after it are removed, so you receive only the text generated up to the trigger.
- No. It does not call any model or send anything over the network. It runs plain JavaScript in your browser to scan the text you paste for the stop sequences you list, then highlights where the cut would happen. Nothing is uploaded or stored.
- Yes — exactly like real APIs.
ENDandendare treated as different strings, and whitespace must match precisely. This is why the preview can surprise you: a sequence that looks right may differ by a capital letter or a space. - The earliest match wins. The tool scans every sequence you list, finds the one that appears first in the text, and cuts there. If two sequences would match at the same character index, the first one listed is reported.
- No. On real APIs the stop string is excluded from the returned text — you get everything before it but not the trigger. That is why this tester shows the discarded portion starting at the matched sequence, dimmed and struck through.
- Usually because a stop sequence is too generic — a single space, a period, or a common word that appears early in the text. The preview makes this obvious: if almost everything is dimmed, your stop sequence is firing too soon. Make it more specific.
- Three things mainly: keeping a chat model from writing the other speaker's turn (stop on
User:), producing clean structured output (stop after one JSON object or list item), and saving tokens by trimming the tail of a completion you do not need. - No. A stop sequence only acts on the model's generated output. It does not change, truncate, or scan your prompt — it simply ends generation when the output would contain the trigger string.
- The core idea — halt and trim at the trigger — is the same across OpenAI, Claude, Gemini and most open models, but parameter names and the maximum number of sequences vary. This tester models the common, vendor-neutral behaviour: earliest, case-sensitive, literal-string match.
- Completely free, with no account or sign-up and no limit on use. It runs in your browser and collects no data.
Related News
You may be interested in these recent stories from our newsroom.
No related news yet for this tool. Our editorial team publishes new pieces every week.
Browse all news →75 more free tools
Calculators, converters, security tools — no signup.