Skip to content

Menu

XML Escape Tool

Escape/unescape XML special characters

Runs entirely in your browserEncodingFree, no sign-up
Loading tool

01What is XML Escape Tool?

When you build XML by hand, a single stray ampersand makes the whole document fail to parse. This tool turns text into something safe to drop inside XML, and back again. The XML 1.0 specification from the W3C predefines exactly five entities: &amp;, &lt;, &gt;, &quot; and &apos;. Escape mode replaces those five characters and nothing else. It handles & first in the same single pass, so it never double-escapes its own output. Em dashes, accented letters and emoji are left alone. That is correct for a UTF-8 document, where they need no escaping at all. Unescape mode reads text the way an XML parser reads character data. It decodes the five predefined entities, plus numeric character references in decimal form like &#65; and hex form like &#x1F600;. It runs in one pass, so each reference is decoded only once. That means &#38;lt; becomes the literal text &lt;, not a less-than sign. A numeric reference beyond U+10FFFF, the last Unicode code point, is left exactly as typed. A quick example. Put <a href="x?a=1&b=2"> into Escape mode and the output is &lt;a href=&quot;x?a=1&amp;b=2&quot;&gt;. All five kinds of special character are covered, including the ampersand hiding inside the query string. Switch to Unescape, paste that result back, and you get the original tag. The screen shows Input and Output side by side, each with a live character count, so you can see how much longer escaping makes your text. Output updates as you type. Copy puts the result on your clipboard and Reset clears the input. Now the limits. Named entities from HTML, such as &nbsp; or &copy;, are not part of XML's predefined set, so Unescape leaves them untouched. Entity names are case-sensitive, so &AMP; also stays as typed. The tool does not check whether a numeric reference points to a character XML allows. A reference like &#0; or a lone surrogate such as &#xD800; still gets converted, even though a real parser would reject it. It also does not parse or validate your XML structure. It only works on characters. Your text is processed by a few lines of JavaScript in the page and stays in your browser.

Backend and Java developers editing XML configs, Android developers working on string resources, and integration engineers building SOAP requests or RSS feeds by hand. The tool runs entirely in your browser, so your data never leaves your device.

02How to use XML Escape Tool

  1. Choose Escape (text → XML-safe) or Unescape (entities → text) in the Mode dropdown.
  2. Paste your text into the Input panel, or load one of the built-in examples.
  3. Read the Output panel, which updates as you type, and compare the character counts above each panel.
  4. Click Copy to take the result.
  5. Click Reset to clear the input and start over.

03Worked examples

Input: Escape: <a href="x?a=1&b=2">
Result: &lt;a href=&quot;x?a=1&amp;b=2&quot;&gt;
All five special characters are replaced, including the & inside the query string.
Input: Escape: Tom & Jerry café 100%
Result: Tom &amp; Jerry café 100%
Only the ampersand changes. The accented é and the percent sign pass through untouched.
Input: Escape: &amp;lt;
Result: &amp;amp;lt;
Already escaped text gets its & escaped again, so escape raw text only once.
Input: Unescape: &#38;lt;
Result: &lt;
Each reference is decoded once, so &#38; becomes & and the rest stays as the text lt;.
Input: Unescape: &#x1F600; &#65;&#x42;
Result: 😀 AB
Hex and decimal numeric character references are both decoded.
Input: Unescape: &nbsp;&copy;&AMP;
Result: &nbsp;&copy;&AMP;
HTML-only entities and wrongly cased names are not XML entities, so they are left as typed.

04Common use cases

  • Putting a product title with an ampersand, like Tom & Jerry, inside an RSS or Atom feed item
  • Pasting a SQL query that contains < and & into a Maven pom.xml or Spring XML config
  • Building a SOAP request body by hand while testing an older enterprise API in a REST client
  • Reading an escaped XML payload copied out of a log line or a JSON field
  • Preparing an attribute value that contains both single and double quotes for an SVG or XAML file
  • Checking whether a feed or export was escaped twice by unescaping it once and looking for leftover &amp;

05Tips

  • Inside element text, only & and < strictly need escaping. Escaping all five is the safe default because the same text often ends up in attributes too.
  • For a long code block, a CDATA section avoids escaping altogether, as long as the text never contains ]]>.
  • If the Unescape output still contains entities like &lt;, the source was escaped twice. Run Unescape a second time, then fix the code that escaped it twice.
  • Escape is not idempotent. Feeding already-escaped text back in turns &amp; into &amp;amp;, so escape raw text only once.
  • Android strings.xml has its own rule on top of XML: apostrophes must also be escaped as \' for the resource compiler.

06Related concepts

XML entities, Character references, CDATA, HTML escaping, Well-formed XML.

Frequently Asked Questions

What is XML Escape Tool?

XML Escape Tool is a free, browser-based developer tool on AIDToolStack. Escape/unescape XML special characters It requires no installation or sign-up and works entirely in your browser.

Is XML Escape Tool free to use?

Yes. No sign-up, no fees and no usage cap.

Does XML Escape Tool store my data?

No. It runs in your browser; nothing is uploaded.

Reviews and commentsShow

Reviews

Sign in to leave a review.

Loading reviews…

Comments

Sign in to leave a comment.

Loading comments…

What changed in AI dev tools, once a month

Renames, shutdowns, pricing changes and new MCP setups, each with a source.

Subscribe