Skip to main content
PromptEval

Format by model

Prompt Format for Claude, GPT and Gemini: What Each Guide Says

Prompt format for Claude, GPT and Gemini: what each official guide recommends (XML, Markdown, examples), with sources checked October 2026.

Short answer: No prompt format is endorsed by all three providers. Anthropic's guide asks for XML tags around each part of the prompt and long documents above the question. OpenAI's GPT-4.1 guide starts from Markdown sections and repeats instructions at both ends of long context. Google's Gemini guide asks for few-shot examples in every prompt and the question at the very end. Role, task and output spec stay the same in all three.

Declaring the output format was worth +29 points on average across the 1,018 prompts in our State of Prompt Quality report, the biggest lift we measured from any single choice. How you declare it, and how you fence instructions off from data, is exactly where the official guides disagree. This page puts the prompt format for Claude, GPT and Gemini side by side, quoting each provider's own guide. Every source below was re-read on October 28, 2026.

Prompt format for Claude, GPT and Gemini, side by side

Prompt format is the packaging around a prompt's content: how sections are delimited, where instructions sit relative to the data, how examples are marked and how the output shape is enforced. The content (who the model is, what it must do, what it must return) barely changes between providers. The packaging does. This table is the reference; the last row links each source.

ElementGPT (OpenAI)Claude (Anthropic)Gemini (Google)
Delimiting sectionsMarkdown headers first; XML tags "also perform well"XML tags named after the content: <instructions>, <context>, <input>XML-style tags or Markdown headings (Gemini 3)
ExamplesAn "# Examples" section in the recommended template3 to 5 examples inside <example> tags"Always include few-shot examples"; clear examples can replace instructions
Instructions in long contextAt the beginning and the end; if only once, above the contextLong documents at the top, query at the end (20k+ tokens)All context first, instructions or question at the very end
Step-by-step reasoningGPT-4.1: add a chain-of-thought line. Reasoning models: unnecessaryAdaptive thinking on Claude 4.6+; always on in Opus 5.5 and Fable 5.1Not necessary to outline reasoning in the response (Gemini 3)
JSON outputStructured Outputs instead of JSON modeStructured outputs with a schema; prefill returns a 400 error on 4.6+JSON Schema passed in the request config
What hurts mostContradictory or vague instructions (GPT-5)Saying only what not to doPrompts with no examples
Official sourceGPT-4.1 guide, GPT-5 guidePrompting best practicesPrompt design strategies
Read on October 28, 2026. Paraphrased except where in quotes. Model names are the ones each guide uses.

Two rows deserve a second look. The long-context row is the only place where the three guides point in different directions: Claude and Gemini want the question last, while OpenAI says that if you state instructions only once, above the context works better than below. And the reasoning row splits by model family, not by provider, which is why "think step by step" is the line that most often goes stale when a prompt moves.

One ticket prompt, four versions, one lint

To see how much the packaging matters on paper, we took a plain support-triage prompt and rewrote it three times, once per guide, without changing what it asks for. Then we ran all four through PromptEval's provider lint: 18 deterministic rules, six per provider, each tied to a passage in the official guide. It's the same rule set behind the free checker at https://prompt-eval.com/en/tools/prompt-format-checker.

Before · plain prose

Classify this support ticket as urgent, normal or low and explain why. Don't be vague and don't make up categories. Ticket: My invoice shows a charge I don't recognize and I can't log in to dispute it.
VersionGPT rulesClaude rulesGemini rules
Before (plain prose)✕ 0/3✕ 1/5✕ 0/4
GPT-style: Markdown sections✓ 3/3✕ 2/5✓ 3/4
Gemini-style: Input:/Output: pairs✕ 2/3✕ 3/5✓ 4/4
Claude-style: XML, 3 examples, a reason✓ 3/3✓ 5/5✓ 4/4
PromptEval provider lint, rules version 2026-08-v2, run October 28, 2026. Denominators differ because rules that don't apply to a 600-character prompt (long-context placement, for example) are left out, and chain-of-thought is reported as a note, never scored.

The result surprised us a little. We expected each rewrite to win its own column and lose the other two. Instead the Claude-style version cleared all three, because XML is accepted by the GPT-4.1 guide and by Google's Gemini 3 guidance, and because it carried things every guide asks for in some form: a role, examples, an explicit output shape and the reason behind the rule. The GPT-style version lost Claude points for having no XML, no examples in tags and no stated reason. The Gemini-style version lost GPT and Claude points for having no section markers at all.

After · Claude-style, passes all 12 applicable rules

You are a support triage assistant for a SaaS billing team. Label carefully, because tickets you mark urgent page the on-call engineer at night. <instructions> Classify the ticket as exactly one of: urgent, normal, low. urgent = the customer cannot use the product or is losing money now. Answer with only the JSON object described below. </instructions> <examples> <example>Ticket: "Site is down for all users" -> {"priority": "urgent", "reason": "Total outage."}</example> <example>Ticket: "How do I change my avatar?" -> {"priority": "low", "reason": "Cosmetic how-to question."}</example> <example>Ticket: "Export to CSV is slow" -> {"priority": "normal", "reason": "Works, but degraded."}</example> </examples> <ticket> My invoice shows a charge I don't recognize and I can't log in to dispute it. </ticket> Respond in JSON: {"priority": "urgent|normal|low", "reason": "<one sentence>"}

What this test does and doesn't show. The lint measures conformance with what each guide writes down. It doesn't run the prompt, so it can't tell you which model will triage this ticket better. Treat a full row of ✓ as a floor: the prompt follows the documented conventions of all three providers, and anything still wrong is about content, which is what a scoring tool or a test set is for.

Claude: XML tags, examples in tags, data above the question

Anthropic's guide makes the clearest format recommendation of the three. In its words, Claude benefits because "XML tags help Claude parse complex prompts unambiguously, especially when your prompt mixes instructions, context, examples, and variable inputs." A tag such as <ticket> tells the model that what's inside is material to process. That matters the day a customer pastes "ignore the instructions above" into a support form: inside a tag, it reads as ticket text.

The rest of the Claude-specific advice, as the consolidated prompting best practices page states it today:

  • Examples: "Include 3–5 examples for best results," wrapped in <example> tags, or <examples> when there are several.
  • Long inputs: for documents of 20k+ tokens, place them near the top, above the query and instructions. Anthropic reports that queries at the end "can improve response quality by up to 30 percent" in its tests.
  • Positive instructions: one section heading reads "Tell Claude what to do instead of what not to do." "Don't use Markdown" works worse than "write in flowing prose paragraphs."
  • The reason behind a rule: the guide asks you to explain why an instruction exists. That's why our rewrite says tickets marked urgent page the on-call engineer.

Two older habits now fail on current Claude models. Prefilling the assistant turn with an opening brace to force JSON is out: the guide says that starting with Claude 4.6 models, "requests with prefilled assistant messages" return a 400 error. The replacement is the structured outputs feature, which constrains the response to a schema you provide. And hand-written reasoning scaffolds matter less, since Claude 4.6 and later use adaptive thinking, and on Claude Opus 5.5 and Claude Fable 5.1 thinking is always on.

Watch for stale tutorials. Claude tutorials written before 2026 often teach prefill and a <thinking> tag as the main tricks. Both were standard advice two model generations ago. If a prompt in your codebase relies on prefill, current models return an error, so search your code for prefilled assistant turns before you upgrade.

GPT: Markdown sections and instructions at both ends

OpenAI's format advice lives in its cookbook prompting guides on developers.openai.com. The GPT-4.1 guide gives the most concrete template of any provider, a skeleton of Markdown sections you fill in and trim:

Template from OpenAI's GPT-4.1 prompting guide

# Role and Objective # Instructions # Reasoning Steps # Output Format # Examples # Context # Final instructions and prompt to think step by step

On delimiters, the guide says of Markdown "We recommend starting here," and of XML "These also perform well." For documents inside the prompt it reports that "XML performed well in our long context testing" and that "JSON performed particularly poorly." So if you have been pasting retrieved documents as a JSON array, that is the cheapest change on this page.

The long-context rule is where GPT differs from the other two. OpenAI says to "ideally place your instructions at both the beginning and end of the provided context," and adds that if you state them only once, above the context works better than below. A prompt written for Claude, with the question only at the bottom, follows half of that advice. Repeating a one-line version of the task at the top fixes it.

The GPT-5 guide adds a warning that changes how you edit long prompts: "poorly-constructed prompts containing contradictory or vague instructions can be more damaging to GPT-5 than to other models." Prompts that grew by accretion (a rule added after each incident) are exactly where contradictions hide, and our guide to finding conflicting instructions in a prompt covers how to spot them. GPT-5 also moved two decisions out of the prompt and into parameters: reasoning_effort (default medium) and verbosity, which controls the length of the final answer.

For JSON, OpenAI is blunt: "We recommend always using Structured Outputs instead of JSON mode when possible," because only Structured Outputs enforce the schema. Our article on how to specify output format in a prompt goes through the prompt side of that decision.

Gemini: examples carry the instructions

Google's guide gives examples a weight the other two don't. The prompt design strategies page says "We recommend to always include few-shot examples in your prompts," and goes further: you can remove instructions from your prompt if the examples show the task clearly enough. The pattern it demonstrates ends with an open response prefix the model completes:

Gemini-style few-shot with a response prefix

Classify each ticket as exactly one of: urgent, normal, low. Respond in JSON only. Input: "Site is down for all users" Output: {"priority": "urgent", "reason": "Total outage."} Input: "How do I change my avatar?" Output: {"priority": "low", "reason": "Cosmetic how-to question."} Input: "My invoice shows a charge I don't recognize and I can't log in to dispute it." Output:

This is also where our data says most people leave points on the table. In the State of Prompt Quality sample, examples appeared in only 5.2% of prompts, yet prompts with them scored +10 points higher on average. For Gemini, whose guide treats examples as close to mandatory, skipping them costs the most.

The Gemini 3 section of the guide adds four points worth copying into a checklist:

  • With large context, "supply all the context first" and place the specific instructions or question at the very end.
  • XML-style tags such as <context> and <task>, or Markdown headings, are both listed as effective delimiters.
  • "Be precise and direct: State your goal clearly and concisely."
  • For earlier Gemini 3 models, leave the generation parameters the guide lists at their default values "to avoid degraded reasoning performance."

For guaranteed JSON, Gemini takes a JSON Schema in the request configuration; the current structured output docs show it as a response_format with an application/json mime type and a schema. The page footer for the prompting guide reads "Last updated 2026-10-13", so this one changes often.

Does "think step by step" still help?

Only on non-reasoning models. The split runs by model family, so the same provider can give opposite advice for two of its own models. This is why PromptEval's lint reports chain-of-thought as a neutral note instead of a ✓ or ✕: when we audited the rules in August 2026, a flat "skip chain-of-thought on GPT" rule turned out to be wrong for GPT-4.1, and a rule asking for a <thinking> tag on Claude had gone stale with adaptive thinking. We removed both from scoring.

Model familyWhat its guide saysKeep the line?
GPT-4.1 (non-reasoning)"We recommend starting with this basic chain-of-thought instruction at the end of your prompt"Yes, for multi-step tasks
OpenAI reasoning models (o3, o4-mini)Asking them to "think step by step" or "explain your reasoning" is unnecessaryRemove it
GPT-5 at minimal reasoning"Prompted planning is likewise more important"Add a short plan of the steps
Claude 4.6 and laterAdaptive thinking; always on in Opus 5.5 and Fable 5.1Remove scaffolds; describe the goal
Gemini 3Generally not necessary for the model to outline reasoning in the responseKeep it out of the output
Sources: OpenAI GPT-4.1 and GPT-5 prompting guides, OpenAI reasoning best practices, Anthropic prompting best practices, Google prompt design strategies. Read October 28, 2026.

If one prompt serves models from both families (a common setup when a fallback model sits behind the main one), make the reasoning line conditional in your template. The reasoning best practices page goes further and says such instructions "may not enhance performance (and can sometimes hinder it)" on reasoning models.

The guide you bookmarked last year has moved

Two of the three providers reorganized their prompting docs in 2026, and the third keeps editing its guide. Old links don't always fail loudly:

ProviderWhat changedWhat to do
OpenAIPrompting docs moved to developers.openai.com. The GPT-4.1 and GPT-5 cookbook guides now carry the banner "This recipe is archived and may reference outdated models or APIs."Keep using their format advice, but check model-specific parameters against the current API docs
AnthropicPer-technique pages on docs.anthropic.com were folded into one "Prompting best practices" page on platform.claude.comUpdate internal wiki links; the per-technique URLs you saved may now point somewhere else
GoogleThe prompt design strategies page gained a Gemini 3 section and was last updated October 13, 2026Re-read it each quarter

A convention that stops being recommended doesn't announce itself. It stays in your saved prompt until somebody notices the output changed. That's the job of PromptEval's Prompt Watch, a weekly email digest that tells you when an official guide changed and a prompt you saved no longer conforms. If you'd rather start from model-specific templates than adapt your own, our prompting guide by model collects system and user prompt skeletons.

How to adapt a prompt from GPT to Claude, or to Gemini

To adapt a prompt between models, keep the content and change only the packaging: swap the section markers, move the question to where the target guide wants it, fix the reasoning line for the model family, and enforce JSON with the provider's native feature. Then re-check it against the target guide.

  1. Freeze the content. Copy out the role, the task, the constraints and the output spec. None of these should change; if you catch yourself rewording them, you're editing the prompt, which is a separate job.
  2. Swap the delimiters. Going to Claude, turn Markdown headers into named XML tags. Going to GPT, Markdown headers are the default, though XML can stay. Going to Gemini, add two or three Input:/Output: pairs.
  3. Move the question. For Claude and Gemini, long data goes first and the question last. For GPT, state the task at the top and repeat it at the end.
  4. Fix the reasoning line. Delete "think step by step" for reasoning models and current Claude; keep it for GPT-4.1-class models on multi-step tasks.
  5. Enforce the output natively. Structured Outputs on OpenAI, structured outputs on Claude (no prefill), a response schema on Gemini. A JSON request written only in prose fails on some fraction of calls.
  6. Re-check before you ship. Paste the adapted version into the free Prompt Format Checker and confirm the target provider's column.

Step six is where most adaptations are confirmed or caught. If you'd rather not do steps two to five by hand, the "Adapt for provider" feature in the paid plans restructures a prompt for GPT, Claude or Gemini without changing what it asks for, and shows the before and after through the same lint. When you want to know whether the content itself is good, the full evaluator gives a 0 to 100 score across clarity, specificity, structure and robustness. Our pillar on how to structure AI prompts covers the structure dimension in depth.

Mistakes when moving a prompt between models

MistakeWhy it breaksFix
Prefilling "{" to force JSON on ClaudeReturns a 400 error on Claude 4.6 and laterStructured outputs with a schema
Retrieved documents pasted as JSON for GPTJSON "performed particularly poorly" as a document format in OpenAI's testsWrap each document in XML
Question at the top of a 30-page Claude promptAnthropic measured up to 30 percent better quality with the query at the endData first, question last
A zero-shot prompt sent to GeminiThe guide says prompts without examples are likely to be less effectiveAdd 2 or 3 Input:/Output: pairs
A rules list that grew by incident, sent to GPT-5Contradictions hurt GPT-5 more than other modelsRemove or reconcile conflicting rules
"Don't do X" lists on ClaudeThe guide asks for what to do insteadRewrite each "don't" as the behavior you want

All six share a root cause. The prompt leaned on one model's habit instead of stating what it wanted, so it worked by luck on the first model and failed on the second. Consistency across models is one of the clearest signs of robustness, the dimension our report found weakest in 96% of prompts, with an average of 31.5 out of 100. Our guide on how to make AI prompts robust covers the input-side tests that catch the rest.

Frequently asked questions

Is there one prompt format that works for Claude, GPT and Gemini?

No single format is endorsed by all three guides, but one baseline satisfies all of them: sections fenced with XML tags, a few input and output examples, an explicit output format, and in long prompts the instruction stated again after the data. XML is Anthropic's recommendation for Claude, OpenAI's GPT-4.1 guide says XML tags also perform well, and Google lists XML-style tags or Markdown headings as effective delimiters for Gemini 3.

Does ChatGPT understand XML tags?

Yes. OpenAI's GPT-4.1 prompting guide recommends starting with Markdown headers but says XML tags also perform well, and in OpenAI's long-context tests XML performed well as a format for documents while JSON performed particularly poorly. Moving a Claude prompt with XML tags to GPT rarely needs a full rewrite.

Why does Anthropic recommend XML tags for Claude?

Anthropic's prompting best practices say XML tags help Claude parse complex prompts unambiguously, especially when a prompt mixes instructions, context, examples and variable inputs. A tag marks where each part starts and ends, so text inside an input tag is read as data to process rather than as an instruction to follow.

Should I still write "think step by step" in my prompts?

Only for non-reasoning models. OpenAI's GPT-4.1 guide recommends a basic chain-of-thought instruction, while its reasoning best practices call "think step by step" unnecessary for reasoning models. Claude 4.6 and later use adaptive thinking, and Gemini 3 guidance says it is generally not necessary to have the model outline its reasoning in the response.

Can I still prefill Claude's response to force JSON?

Not on current models. Anthropic's guide says that starting with Claude 4.6 models, requests with prefilled assistant messages return a 400 error. Use the structured outputs feature, which constrains Claude's response to a JSON schema you provide.

Score your prompt before it ships

PromptEval scores a prompt from 0 to 100 on clarity, specificity, structure and robustness. Your first check needs no signup.

Check a prompt free →