Chat template renderer
See the exact prompt string a model receives: Llama 3, Qwen, Mistral, Gemma, Phi and DeepSeek templates, rendered from your messages.
Input
Result
The result will appear here.Every open model wraps a conversation in its own markup before it sees a single token — Llama 3 uses header tags, Qwen uses ChatML, Mistral uses [INST] blocks, Gemma refuses a system role outright. When a fine-tune behaves oddly or a self-hosted server answers differently from the Hub, the cause is often that the template applied was not the one the model was trained with. This tool runs the real Jinja chat_template from each model's tokenizer_config.json through the same engine transformers.js uses, so what you see is byte for byte what apply_chat_template would produce: special tokens, newlines, the generation prompt and, for Qwen3, the thinking switch.
How it works
- Paste an OpenAI-style messages array, an object with messages (and tools), or a plain transcript with user:/assistant:/system: lines; pick the model family.
- The template is the one shipped in the model's tokenizer_config.json, rendered by @huggingface/jinja in your browser — nothing is sent anywhere.
- Toggle the generation prompt (the trailing assistant header that tells the model to answer) and Qwen3's enable_thinking flag to compare the variants.
Where your data goes
Nowhere. This tool runs entirely in your browser: the text you paste is processed by the page and is never transmitted to a server or written to a log.
This tool is free and needs no account. Its results exist only in your open page and are not saved anywhere.
What it costs
This tool is free, with no sign-in and no points.
Common questions
- Why does Gemma show my system message inside the user turn?
- Gemma's own template raises an error on a system role. The renderer catches that and folds the system text into the first user message, which is what the Gemma model card recommends and what most serving stacks do silently. The stats panel tells you when this happened.
- Can I check how tool definitions are inserted?
- Yes. Paste an object with both messages and tools (OpenAI function-calling format) and choose a template that supports tools — Llama 3.1, Qwen2.5, Qwen3 and Mistral 0.3 all render the tool list into the system area the way their training data did.
- Which model versions are the templates from?
- Snapshots taken 2026-10-01 from meta-llama/Llama-3.1-8B-Instruct, Qwen/Qwen2.5-7B-Instruct, Qwen/Qwen3-8B, mistralai/Mistral-7B-Instruct-v0.3, google/gemma-2-2b-it, microsoft/Phi-4-mini-instruct and deepseek-ai/DeepSeek-V3. Model families share templates across sizes, so the 8B template is the 70B template too.
- The count of special tokens is not the same as the token count.
- Correct — this tool counts the control markers (<|eot_id|>, <|im_end|>, [INST] and the like) it can recognise, not BPE tokens, because every family has its own tokenizer. For a token count of the rendered string, paste it into the token counter and pick the closest encoding.
The open-source behind it
This tool is a self-contained implementation. huggingface/transformers (Apache-2.0) does the same job as a library — if you need this behaviour inside your own program, start there rather than calling a web page.
huggingface/transformersAlso known as
- chat template renderer
- apply_chat_template online
- llama 3 prompt format
- chatml format qwen
- jinja chat template
- special tokens prompt