Special token decoder
Special tokens are the invisible scaffolding of every LLM conversation — the <|im_start|> and
[INST] markers that tell the model where a turn begins, who is speaking, and when the document
ends. This tool scans your prompt or chat JSON, lists every special token it finds, explains what
each one does, and warns you about any you have accidentally typed into user content.
How it works
The decoder matches your input against the known special-token vocabularies of major model families — ChatML (OpenAI), Llama, Mistral, and Gemini. For each match it reports:
- the literal token,
- its role (turn start, turn end, sequence boundary, instruction wrapper, etc.),
- whether it is normally template-inserted (added by the API) or manual (typed by you), and
- an estimated token cost of one each.
It also flags tokens that belong to a different family than the one you selected, which is a common copy-paste mistake when adapting a prompt across models.
Tips and notes
- Treat special tokens as structure you should never type by hand. If you need a literal
<|endoftext|>in user text, the safe pattern is to let the model never see it as a control token — most APIs reject or escape it for you, but do not rely on that. - Mixing families silently fails:
[INST]does nothing on a GPT model, and<|im_start|>does nothing on raw Llama. The decoder highlights mismatches. - The total special-token count is your fixed per-message overhead before any visible content — pair this with the chat-template overhead analyzer to see the monthly cost of that scaffolding.
- A user message containing what looks like a control token is a classic prompt-injection signal; flag and sanitize it server-side.