EN
My tools

XML Escape / Unescape

Escape text for XML element content or attribute values (& < > " '), decode entities and &#…; references, or wrap text in a safe CDATA section.

Result
Tom &amp; Jerry's "Best" &lt;Episodes&gt; — 5 &gt; 3
Characters escaped
4
My tools →
Advertisement

Text that goes into an XML document — a feed title, a SOAP field, a configuration value, an SVG label — must not contain a raw & or <, and inside attribute values the quotes and line breaks need care too. This tool escapes text for element content or for attribute values, can turn non-ASCII characters into &#…; references, wraps text in a CDATA section that survives "]]>", and decodes escaped XML back into plain text.

How to use this tool

  1. Paste the text or the escaped XML.
  2. Choose Escape, Unescape or CDATA.
  3. For escaping, say whether the text goes between tags or inside an attribute value, and how to write non-ASCII characters.
  4. Copy the result.

Formula

& → &amp; · < → &lt; · > → &gt; · " → &quot; · ' → &apos; (attributes) · line break in an attribute → &#10;

XML 1.0 requires & and < to be escaped everywhere; > only after ]] but escaping it is always safe. In attribute values the quote that delimits the value must be escaped, and literal tabs and line breaks are turned into spaces by every parser, so they are written as references. Characters XML 1.0 forbids (most control characters, U+FFFE, U+FFFF) cannot be written at all, not even as &#…;, so they are removed or reported. Unescaping decodes the five XML entities and all numeric references in one pass; HTML names are optional.

Example

The sample Tom & Jerry's "Best" <Episodes> — 5 > 3 escaped for element content becomes Tom &amp;amp; Jerry's "Best" &amp;lt;Episodes&amp;gt; — 5 &amp;gt; 3 (4 characters escaped). For an attribute value the quotes become &amp;quot; and the apostrophe &amp;apos; as well. Wrapping a]]>b in CDATA gives <![CDATA[a]]]]><![CDATA[>b]]>.

Frequently asked questions

Is XML escaping the same as HTML escaping?

Almost. XML predefines only &amp; &lt; &gt; &quot; and &apos;. HTML names such as &nbsp; or &copy; are errors in XML unless a DTD declares them — use &#160; or the character itself.

Should I use CDATA or escape?

Both give the same text to a parser. CDATA keeps code or markup readable, but it cannot be used inside attribute values, and "]]>" has to be split as shown here.

Why was a character removed?

XML 1.0 forbids control characters such as U+0007 or U+001B anywhere in a document, even written as &#7;. Choose "Stop with an error" to find where they are.

Is my text uploaded?

No. Everything runs in your browser.

Sources

Last updated:

Cite or embed this tool
APA

kakaoCalc. (2026, November 8). XML Escape / Unescape. https://kakao.mobile/tools/xml-escape-unescape-tool/

MLA

“XML Escape / Unescape.” kakaoCalc, 8 Nov. 2026, kakao.mobile/tools/xml-escape-unescape-tool/.

Paste this code into your page. The widget runs in your visitors' browsers, shows no ads and keeps a link back to this page. Embedding terms

Advertisement