Skip to content

XML Escape

Escapes or unescapes an XML string, replacing the five reserved characters with their corresponding XML entities.

Loading tool...

XML escaping explained

Why escape XML?

An XML parser treats < as the start of a tag and & as the start of an entity reference. If those characters appear literally, the document is not well-formed and every parser must reject it.

The five predefined entities

Character Entity
' (apostrophe) &apos;
" (double quote) &quot;
& (ampersand) &amp;
< (less than) &lt;
> (greater than) &gt;

Unlike HTML, XML has no named entities for accented letters. Non-ASCII characters are written literally (usually UTF-8) or with numeric references.

---