Escape / Unescape
XML Escape / Unescape
The five XML entities, handled both directions — make any text safe inside elements and attributes.
In short
Escape and unescape XML online: the five predefined entities (& < > " ') and numeric references, converted both directions instantly.
By NaveenKumar T · Updated
Learn: HTML Entities Explained: When to Escape &, <, > and Quotes
- Escape & unescape in one tool
- Handles every special character
- Instant as you switch modes
Runs entirely in your browser — nothing you paste or open here is uploaded, logged, or stored.How we handle data →
Example
XML Escape: input and output
Preparing a supplier note for a <description> element in a SOAP message.
Vendor: Müller & Söhne <sales@example.com>
Spec: M8 'hex' bolt, "A2-70", length < 40 mmVendor: Müller & Söhne <sales@example.com>
Spec: M8 'hex' bolt, "A2-70", length < 40 mmAll five predefined entities appear in the output — &, <, >, " and ' — while the umlauts are left alone because XML is Unicode-native.
Learn more
XML escaping rules
XML predefines exactly five entities, and unlike HTML there are no others without a DTD: & for &, < for <, > for >, " for double quote, ' for apostrophe. Escaping text before placing it in element content or attribute values prevents the classic 'unescaped ampersand' error that breaks feeds and SOAP messages — the single most common cause of invalid XML in the wild.
Unescaping decodes those five plus numeric character references (©, —), which generators emit for characters outside ASCII. Note that HTML-only named entities like are NOT valid XML — if your document contains them, it was HTML all along; use the HTML Escape tool's unescape instead.
The five predefined XML entities
XML defines exactly these five — no DTD, no configuration, no browser quirks to account for. Everything else (©, é, emoji) is either written as the literal UTF-8 character or as a numeric reference; there is no such thing as a sixth named XML entity without declaring it yourself in a DTD.
| Character | Entity | Where it must be escaped |
|---|---|---|
| & | & | Always — in text content and in attribute values |
| < | < | Always — a raw < is read as the start of a tag |
| > | > | Strictly only inside the literal sequence ]]>, but escaping it everywhere is always safe |
| " | " | Inside an attribute value delimited by double quotes |
| ' | ' | Inside an attribute value delimited by single quotes |
Help
Frequently asked questions
Everything you need to know about the XML Escape.
01How do I escape or unescape XML here?
Paste your text, pick Escape or Unescape in the Mode select, and press Convert. Escape converts to the five predefined XML entities (& < > " '); Unescape decodes those plus numeric character references.
02Why did my XML break on a & that 'worked' before?
An ampersand followed by characters that happen to look like an entity (© in a URL query, say) may parse in lenient HTML but is fatal in XML: every & must start a valid entity or be written &. Run your text through Escape mode before inserting it into XML and the problem disappears permanently.
03Do I really need to escape > and quotes, or only & and <?
Strictly, XML text content only forbids a raw & and <; > is illegal only in the sequence ]]>, and quotes matter only inside attribute values. Escape mode converts all five anyway, so the result drops safely into element content or an attribute delimited by either quote style. It is unconditional, though: already-escaped input is escaped again (& becomes &amp;), so run it exactly once. Unescape restores the five entities plus decimal and hex references such as © and —.
Keep working
Related tools
HTML Escape
Escape / Unescape
XML Formatter
Re-indent any XML document into clean, readable markup — comments and CDATA preserved, validation built in.
XML Validator
Strict well-formedness checking with the exact line and column of every violation — fix XML errors in seconds.
JSON Escape
Escape / Unescape
SOAP Formatter
Turn captured SOAP envelopes into readable XML — Header and Body cleanly indented, namespaces intact.
XML Parser
Run a real XML parse in your browser — see the structure parsers produce, or exactly where they fail.
Learn the format
Related guides
HTML Entities Explained: When to Escape &, <, > and Quotes
Which characters to escape in HTML text, attributes, URLs and scripts, how named, decimal and hex references differ, and why you keep seeing &amp;.
9 min readGuide · Data FormatsXML Namespaces Explained: Prefixes, Default Namespaces and Common Errors
What xmlns and xmlns:prefix do, how default namespaces scope and inherit, why attributes are excluded, and why XPath returns nothing on namespaced XML.
7 min readTutorial · Data FormatsXML Tutorial: Structure, Syntax & Survival Skills
A working developer's XML tutorial: elements, attributes, namespaces, escaping, and well-formedness rules — with the errors that actually break parsers.
2 min read