Markdown, XML, or JSON: How to Format a Prompt So the Model Understands It

Written by Madalina Turlea
15 Jan 2026
When you write a prompt, you are talking to the model in natural language, but formatted. There are three common formats you can reach for, and which one you use can change your accuracy more than you would expect.
The three formats
Markdown is the easiest. It gives you headlines, subtitles, and lists, so you can define the structure of the information and the model understands the hierarchy. The difference between Markdown and plain text is usually quite significant, even for smaller improvements to a prompt.
XML is the next level. With XML you can be much more specific. Every section can be its own tag, which makes it much easier for the machine to understand the sections. Anthropic's own prompting guide recommends putting data you want to pass over, like your domain knowledge, inside XML tags, because the model can read it better.
JSON is a more technical format. It makes the most sense when you actually have technical data, or data coming from APIs and backends. For general structures, Markdown and XML are usually the right tools.
Why structure beats prose
The underlying idea is that the more concrete you are, the better your results, because you let the model do less of the thinking. Instead of leaving it to work out the structure of your instructions on its own, you tell it directly: this is the most important thing, then this is the next thing, then this is a list with three items.
When you format the document, you are doing that work for the model so it does not have to.
What the experiment showed
In an expense-policy experiment, the same policy was given to the model two ways. With a basic placeholder, GPT-5 reached 43% accuracy. With the policy formatted as XML inside a structured prompt, the same model reached 86%. The structured XML formatting significantly outperformed the placeholders, and other models, including Claude Opus and Gemini Pro, also performed better with the structured prompt.
In a separate invoice-extraction experiment, simply having structured, clear sections achieved the same performance as adding all caps on top. The structure itself was doing the work.
You do not have to write the XML by hand
Writing XML yourself is not very complicated, but it takes time. A faster route is to ask a chat model to format your document as XML for you, then copy that XML into your prompt. The words stay the same, only the formatting changes.
The practical takeaway is to treat formatting as something you experiment with. Try Markdown, try XML, and for very technical input and output, try JSON, then see which one makes the model understand your task better for your specific problem.
You might also like

We Tested the Viral Prompt Tricks. Most of Them Do Nothing.
Threatening the model, all caps, high-stakes framing — we ran the viral prompt techniques across nine models on real extraction tasks. Structure and clarity beat hacks every time.

Building an Expense-Policy AI Agent: What We Learned Reverse-Engineering Ramp
Three prompts, six models, 126 runs. What we learned trying to reverse-engineer Ramp's expense-policy AI agent — including why a more detailed prompt actually made GPT-5 worse.

Why ChatGPT Gets Dumber the Longer You Talk to It
Long chats degrade for a concrete reason: the context window. The model is not remembering — it is being re-sent the whole conversation every turn, and there is a hard limit.