How This XML Escape Tool Works
Paste text and pick a direction, xml escape converts the five XML special characters into their entity form, xml unescape converts them back, and this tool works as a genuine escape xml characters online workflow with no upload, no signup, output updates as you type.
Why Ampersand, Less-Than, and Greater-Than Are Always Escaped
Ampersand, less-than, and greater-than are always escaped when you choose xml escape ampersand handling and the escape direction, because these three characters have structural meaning in XML, an unescaped & starts an entity reference, an unescaped < opens a tag, and leaving either unescaped anywhere in element text produces invalid XML that won't parse. This tool's xml entity escape logic always converts & first, before < and >, so an already-escaped < never gets its ampersand re-escaped into &lt;.
When to Also Escape Quotes and Apostrophes
Double quote and single quote (apostrophe) are structurally significant only inside an attribute value, not in ordinary element text, so this tool's xml character escaping keeps them optional and independently toggleable. Turn on xml escape apostrophe handling when your text is going into a single-quoted attribute, like id='value', and turn on quote escaping when it's going into a double-quoted attribute, like id="value", leave both off when you're only escaping element text and don't need either.
Common Uses
Reach for this tool whenever you're generating XML programmatically and need to safely embed unpredictable user input, or need to unescape xml entities coming back from an API, RSS feed, or SOAP response before displaying the raw text. As an xml escape online free tool it also decodes numeric character references, not just the five named xml special characters, so entities like © or – convert back to their literal characters too.