XML Escape and Unescape
Escapes text so it can be dropped into XML content or a quoted attribute, and decodes entity references back to plain text.
Loading the tool…
How to use this tool
- Paste the text you want to put inside XML, or the escaped text you want back.
- Select Escape or Unescape.
- Copy the result into your element content or attribute value.
What xml escape and unescape does
Five characters cannot appear literally everywhere in XML: the ampersand, the two angle brackets, the double quote and the apostrophe. An unescaped ampersand in text is the single most common reason a generated XML file will not parse, and it usually arrives inside a URL that somebody concatenated into an element without thinking about it.
Escaping here covers element text and double-quoted attribute values, which is what almost everyone needs. Unescaping resolves named entities such as &, decimal references such as é and hex references such as é. Entities that a DTD defined are left as they are, because their definitions are not in front of us and inventing a value would be worse than leaving the text alone.