XML Escape
Escape XML special characters so text is safe inside markup. It runs entirely on your device — nothing is uploaded.
Reviewed by the CalcCafe editorial team · Last updated 1 July 2026 · How we test our tools
Example
a < b & c
a < b & c
How it works
Characters like <, > and & are replaced with their XML entities.
Good to know
XML Escape converts the characters that have special meaning in XML — chiefly the ampersand (&), less-than (<) and greater-than (>) signs, and often the single and double quote — into their named entity equivalents (&, <, >, ', "). It is built for developers, technical writers, and anyone hand-editing XML, RSS/Atom feeds, SVG, SOAP messages, Android string resources, or XML-based config files who needs to drop arbitrary text into an element or attribute without breaking the document's structure.
Reach for it whenever raw text contains characters a parser would otherwise treat as markup. The classic case is putting source code, math expressions, or URLs with query strings inside an element: an unescaped & or < will throw a "not well-formed" error or silently truncate your content. Escaping first guarantees the value is interpreted as literal text rather than the start of a tag or entity.
Reading the result is straightforward — compare input to output and you should see only the reserved characters changed; everything else, including letters, numbers, and whitespace, passes through untouched. If your output looks identical to the input, that simply means the text contained no characters that needed escaping.
- Escape only once. Running already-escaped text through again turns
<into&lt;, a common double-encoding bug that shows up as visible entity codes in the rendered output. - For text going into an attribute value, make sure quotes are escaped to match your delimiter; for element content, escaping
&,<, and>is usually enough.
Frequently asked questions
Is my data uploaded anywhere?
Is this tool free?
People also ask
What characters need to be escaped in XML?
What is the difference between XML escaping and HTML escaping?
How do I reverse XML escaping?
Can I use numeric character references instead of named entities?
Do I need to escape characters inside a CDATA section?
Why does my XML show &lt; instead of < after escaping?
Is escaping required for non-ASCII or Unicode characters in XML?
Related tools
- XML Formatter
- XML Pretty Print
- XML Parser
- XML Viewer
- XML Editor
- XML Minify
- XML Validator
- XML Unescape
Sources & references
These tools follow our methodology and provide educational estimates only — verify important figures with a qualified professional.