LLM Chat Format Converter
Translate conversations between OpenAI messages, ChatML, Anthropic, Llama 2/3, Mistral and markdown — with every lossy mapping reported.
Conversation
auto: openai · 16 lines · 285 charsNo request is sent and no prompt is stored — prompts often contain proprietary context.
Converted prompt
3 message(s) · ~46 tokens<|im_start|>system You are a concise support assistant.<|im_end|> <|im_start|>user Where is my order?<|im_end|> <|im_start|>assistant Check your account page for tracking.<|im_end|>
Token count is a quick characters/4 estimate, not tokenizer-exact.
Examples
ChatML to Anthropic
System + user + assistant ChatML transcriptTop-level system string and content-block messagesConsecutive same-role turns are merged because Anthropic requires alternation.
Llama 2 system handling
System message plus a user/assistant exchange[INST] <<SYS>> system <</SYS>> question [/INST] answer </s>The warning explains that the system prompt was prepended rather than dropped.
Generation prompt
Conversation ending with a user turnAn empty assistant message appended at the endUseful when an API expects the assistant prefix to signal that it should generate.
About this tool
LLM Chat Format Converter translates whole conversations between OpenAI messages, ChatML, Anthropic content blocks, Llama 2/3 templates, Mistral's [INST] syntax and markdown transcripts.
Input parsing accepts JSON arrays or wrapped messages, ChatML tokens, Llama header blocks, [INST] exchanges and 'Role: text' lines. Role aliases such as human, bot and AI normalize to user or assistant, while unsupported roles are dropped with an explicit warning.
The loss report calls out every transformation: consecutive-turn merges required by Anthropic, system prompts folded into Llama 2's <<SYS>> block, BOS prepending, and generation prompts. Nothing is uploaded; all parsing and emission happen locally.
What this tool does not do
- Tool/function-call payloads are not transported into template targets.
- Llama 2 and Mistral targets have limited system-message support.
- Markdown parsing handles simple 'Role: text' lines, not arbitrary transcripts.
- Token estimates are heuristic, not tokenizer-exact.
- Unbalanced template tags yield partial parses with warnings rather than perfect recovery.
How to use this tool
Paste a transcript
Load a sample or paste your conversation; the format is detected from its markers.
Override the source if needed
Choose an explicit source format when auto-detection cannot decide or a file uses an ambiguous shape.
Pick a target and options
Select ChatML, OpenAI, Anthropic, Llama 2/3, Mistral or markdown; toggle generation prompt, BOS, merging and pretty JSON.
Read the loss report
Review merge, drop and hint warnings before copying or downloading the converted transcript.
Use cases
Provider migration
Port evaluation prompts between OpenAI, Anthropic and open-weight model templates.
Prompt documentation
Turn wire-format transcripts into readable markdown for review.
Template debugging
Compare emitted templates and see exactly which control tokens each format expects.
Emitted formats
| Target | Shape |
|---|---|
| OpenAI | {messages: [{role, content}]} JSON; pretty or minified. |
| ChatML | <|im_start|>role / content / <|im_end|> blocks. |
| Anthropic | {system, messages: [{role, content: [{type:'text'}]}]}. |
| Llama 2 | [INST] … [/INST] with optional <<SYS>> and </s>. |
| Llama 3 | <|start_header_id|>role<|end_header_id|> … <|eot_id|>. |
| Mistral | [INST] … [/INST] with </s> reply terminators. |
| Markdown | **Role:** content paragraphs. |
Template targets cannot transport tool calls; structured formats preserve message roles verbatim.
Common mistakes
Mistake:Assuming templates transport every structured field.
Fix:Tool calls, names and image parts are not mapped by template targets; keep structured formats for those.
Mistake:Sending consecutive same-role messages to Anthropic.
Fix:Leave merging on; the loss report lists every merged turn.
Mistake:Forgetting a generation prefix.
Fix:Enable the generation prompt option when the conversation ends on a user turn.
Mistake:Believing Llama 3 and Llama 2 share a template.
Fix:Choose the correct target: Llama 3 uses header tokens, Llama 2 uses [INST] and <<SYS>>.
Mistake:Trusting chars/4 tokens as exact.
Fix:The badge estimates emitted text length; use a model tokenizer for exact accounting.
Frequently asked questions
How does Llama 2 handle system prompts?
Llama 2 has no dedicated system role in its [INST] template, so the converter prepends the system text inside a <<SYS>> block at the beginning of the first instruction and reports the move in the loss report. Other targets keep system messages as first-class messages where the format allows them.
Why must Anthropic messages alternate roles?
The Anthropic Messages API expects user and assistant turns to alternate. When an OpenAI-style transcript has two consecutive user or assistant messages, the converter joins their content with a blank line and lists a WARN_MERGE entry. Turn the merge option off only if you intend to repair the transcript yourself.
What is ChatML syntax?
ChatML marks each turn with <|im_start|>role, a newline, the content, and <|im_end|>. The parser understands balanced blocks and reports partial parses when tags are unbalanced. ChatML is a common interchange format for fine-tuning and local inference servers.
How do I convert a conversation to Llama 3?
Choose the llama3 target. The emitter writes <|start_header_id|>role<|end_header_id|>, two newlines, the content and <|eot_id|> for each turn, optionally prefixed with <|begin_of_text|>. Do not reuse Llama 2's [INST] output for Llama 3 models; the control tokens differ.
Are tool calls converted?
Not into template targets. Llama, Mistral, ChatML and markdown emit text only, so tool-call metadata cannot be represented faithfully. Structured OpenAI and Anthropic output keeps ordinary message roles and text content; tool/function fields are outside this tool's scope and are reported as unsupported where encountered.
Does my conversation leave the browser?
No. Detection, parsing, role normalization, emission and downloads all run locally. There is no network call and no stored history of your transcripts after you leave the page.
References & standards
Related tools
Agent Tool Flowchart Builder
Design agentic tool-call DAGs with decision branches and bounded loops. Validates reachability, cycle handling, and emits clean Mermaid flowcharts — fully in your browser.
AI Agent Memory & Buffer Simulator
Compare sliding window, summary buffer, and vector memory strategies
AI API Client SDK Generator
Generate typed API client SDK files from OpenAPI specifications or cURL requests
AI Code Explainer
Explain code snippets with grounded cloud AI
AI Code Security Auditor
Scan source code for high-confidence OWASP Top 10 vulnerabilities
AI Code Translator
Translate code into idiomatic implementations in another language