XML Prompt
Generator.
Free builder for XML-tagged prompts. Claude-native, cross-model compatible. Minimal, standard, and rich formats.
Tag structured prompts produce more reliable output. Especially on Claude.
Describe what you want
3 prompt variations
Click Copy to use<task> [describe the task] </task>
<task> [describe the task] </task> <deliver> Return the output only, inside the response. No preamble, no closing remarks. </deliver>
<role> Expert at the task below. </role> <task> [describe the task] </task> <thinking> Before writing the output, think through: 1. What does excellent output look like for this task? 2. What could go wrong in a naive attempt? 3. Which constraint is hardest to satisfy? </thinking> <verify> After drafting, re-read and check every constraint is satisfied. If not, revise. </verify> <deliver> Return only the final output. No preamble. </deliver>
Under the hood
Why XML tags beat prose for structured prompts.
Tags make section boundaries explicit. The model stops guessing where your input ends and your instruction begins. That alone produces a noticeable accuracy lift on prompts with multiple distinct sections.
Claude was trained with XML-tagged examples. It follows tagged structure more reliably than unstructured prose. If you are running Claude, XML is the format you should default to.
Adding a thinking tag lets the model plan. Adding a verify tag makes it re-check. Both roughly double response length but lift quality meaningfully on hard prompts. Use them for anything high-stakes.
Related free tools
Specialized generators for specific tasks.
FAQ
Questions about XML prompting.
Why use XML tags in prompts?+
XML tags give the model clear boundaries between sections. Instead of the model guessing where your input ends and your instruction begins, tags make it explicit. Claude was trained with XML-tagged examples and follows tagged structure unusually reliably. GPT and Gemini also benefit but the lift is biggest on Claude.
What tag naming convention works best?+
Claude's own docs recommend lowercase snake_case (role, task, output_format). That is the convention this generator uses by default. Capitalized tags (Role, Task) work too but are slightly less reliable. Stay consistent across one prompt, do not mix styles.
Are XML tags necessary for short prompts?+
No. For a one-sentence ask, tags add overhead without improving output. Use tags when you have multiple distinct sections: a role, an input document, constraints, and an output schema. Once you have three or more sections, tags meaningfully improve reliability.
Do XML tags work with GPT-5 and Gemini?+
Yes. GPT-4 and GPT-5 handle XML-tagged prompts well, and Gemini 2.5 does too. The format lift is smaller than on Claude but still present. For GPT specifically, markdown headings (## Role, ## Task) sometimes work as well as XML. For Gemini, either works. For Claude, XML wins.
What does the <thinking> tag do?+
It tells Claude to think through the task before producing the output. Claude often treats content inside <thinking> as scratch work. When combined with a <deliver> tag that says 'return only the output', you get the benefit of reasoning without the cost of verbose responses.
Do I need to close every tag?+
Yes. Claude is forgiving of malformed XML but well-formed is safer. For nested content, use clear open and close pairs. If your input itself contains XML or angle brackets, wrap it in a <![CDATA[...]]> section or pick a different delimiter.
What is the richest format actually doing?+
The rich variant adds explicit <thinking> and <verify> sections. Thinking asks the model to plan before writing. Verify makes it re-check the output against constraints. Both roughly 2x the response length but noticeably lift quality on hard tasks. Use for high-stakes prompts.
How is XML different from JSON output?+
XML tags structure the INPUT prompt. JSON is usually about the OUTPUT format. You can combine them: XML-tag your prompt for clarity and ask for JSON output for downstream parsing. The JSON prompt generator handles that flip side of the coin.