Are XML Tags Really Useful For LLM Prompting? - I Asked Myself
Spent the Sunday falling down the rabbit hole of XML tags and AI prompts in a burning need to understand why a number of people are obsessed.
Until today, I never really understood the hype around the use of XML tags for AI prompts, despite seeing it multiple times on Reddit.
But today, I could no longer deny the curiosity. So, I did what every normal person does on a lazy Sunday: I started digging.
Apparently, AI models can understand your needs better when you use XML-style tags. Why? Because they create clear boundaries. When you use normal texts, headings, and bullet points, the AI still has to play FBI to guess where one idea ends and another begins. XML tags eliminate that uncertainty.
Practical Example
Example → Regular English Style:
I’m building a mobile app for restaurants. Must work offline, sync when online and must collect tip from everyone by force. Like Toast POS but simpler.
Example → XML Style:
<context>
I’m building a mobile app for restaurants. We have 50 locations
and spotty internet in kitchens.
</context>
<requirements>
- Must work offline with local data storage
- Sync orders when connection restores
- Must collect tips whether the person likes it or not
</requirements>
<examples>
Toast POS offline mode
</examples>
That shift makes the AI go, “Ahhh, I see what you did there”, instead of “Wait, what are we doing again?”
Advanced Techniques
1. Nested tags for hierarchy:
<project>
<background>
<business_context>We’re a B2B SaaS...</business_context>
<technical_context>Current stack is React/Node...</technical_context>
</background>
<task>
Evaluate whether to migrate to Next.js
</task>
</project>
This helps when your prompt starts sounding like confusion.
2. Sequential processing:
<step_1>
First, analyze this data: [data]
</step_1>
<step_2>
Then, using only the findings from step 1, create a summary
</step_2>
That forces the AI to follow instructions in order, rather than jumping to step 47 because it got excited.
When It Can Be Useful
The effectiveness of XML tagging seems higher when you have complex prompts (multiple sections, many examples, nested logic, or machine‐readable structure. It’s also helpful when making requests over the API.
Essentially, when there’s potential for confusion, XML can be a safety net.
This blog article speaks more about it.
My Actual Conclusion
After all the digging and experimentation, I’ve come to conclude that the benefit stems from the structure rather than specifically XML tags. Which means if you can structure your regular English prompts properly, it works just as fine.
Sure, XML makes things cleaner in edge cases, but the newer LLM models are so good, they’ll figure it out anyway. Unless you’re doing something extremely structured, like parsing multiple files or separating logic layers, XML might just be overkill.
So yeah… For now, I’ll stick to my usual English prompting like a normal human.
Maybe, one day, in the future, I’ll find a real use for XML tags.





Regarding the topic of the article, loved the 'AI playing FBI' line. It perfectly captures the strugle.