Prompt to XML Formatter

Convert plain prompts to Claude-style XML-tagged prompt structure

Ad placeholder (leaderboard)

Prompt to XML formatter

Anthropic’s prompting guidance recommends wrapping the parts of a prompt in XML-style tags<instructions>, <context>, <examples>, <output_format> — because Claude is trained to treat them as clean section boundaries. This tool takes a plain-text prompt and does that wrapping for you, detecting likely sections from headings and keywords so you start from a structured draft instead of a wall of text.

How it works

The formatter splits your prompt into blocks on blank lines and headings, then classifies each block:

  • blocks mentioning “example”, “e.g.”, or input/output pairs become <examples>,
  • blocks mentioning “format”, “respond with”, or “output” become <output_format>,
  • background or reference material becomes <context>,
  • everything imperative defaults to <instructions>.

You can switch to a custom tag style if your team uses different names. The output is indented, valid XML you can paste straight into a Claude prompt. Because detection is heuristic, treat the result as a first pass — re-tag any block the parser misread.

Tips and notes

Separate your sections with blank lines or short headings before pasting; clearer input gives cleaner tagging. Keep <examples> tight — two or three high-quality input/output pairs usually beat a dozen mediocre ones. Put the <output_format> block last so it stays fresh in the model’s context when it starts generating. And if you also target GPT or Gemini heavily, compare the XML version against the Markdown formatter’s output and keep whichever the target model follows more reliably.

Ad placeholder (rectangle)