Tags exist in a prompt for one reason: to make it unambiguous where the instructions stop and the content starts. That boundary matters most when the content is not yours — a pasted document, a support ticket, anything a user supplied — because text that closes the section it is inside gets read as instruction. Escaping the content is what prevents that, and it is the step most hand-built prompts skip. This wraps sections, escapes what goes in them, sanitises names into valid tags, and works in reverse too: paste a tagged prompt and pull the sections back out to edit one in isolation.
Features
Content escaped so it cannot close its own section
Tag names sanitised into something valid, and shown as you type
Block or inline wrapping
Pull sections back out of an existing tagged prompt
Finds tags opened and never closed
Load extracted sections straight back into the editor
Empty sections dropped rather than emitted
Round-trips: wrap, extract, edit, wrap again
How to use the XML Prompt Section Builder
Name each section and paste its content
Leave escaping on for anything you did not write
Copy the tagged prompt
Or paste an existing one to pull its sections apart
Example
Input
Customer Ticket
Output
<customer-ticket>…</customer-ticket>
Names are sanitised — tags cannot contain spaces or capitals.
Common errors & troubleshooting
My tag name is changed. — Tag names cannot contain spaces or capitals and cannot start with a digit. The sanitised version is shown beside the field as you type.
A section is not extracted. — Extraction needs a matching closing tag. Unclosed tags are listed separately, since they are usually the actual bug.
Should I escape my own instructions? — It rarely matters for text you wrote and always matters for text you did not. Leaving it on is the safe default.
Do tags actually help? — They help most where content and instructions meet. For a short prompt with no embedded content, headings are just as clear and cost fewer tokens.
Frequently asked questions
Why use tags rather than headings?
Headings mark structure for a reader; tags mark a boundary that content cannot cross. When you are embedding a document or user-supplied text, the second property is the one that matters.
Does this stop prompt injection?
It removes one specific route — content that closes its own section and continues as instructions. It does nothing about content that simply contains persuasive instructions inside the section, which is a question of how the instructions treat what they find there.
Is this XML?
It looks like XML and is not parsed as XML. That is why only the three characters that would break a boundary are escaped, rather than producing something strictly well-formed.
Can I get my sections back out?
Yes — paste a tagged prompt and the sections are extracted, then loaded into the editor if you want to change one and rebuild.
Do tag names matter?
Descriptive ones help. <customer-ticket> tells the reader what is inside far better than <data>, and it costs the same.