Developer tools ● Local processing

XML Text Escaper

Escape special characters in XML 1.0 text and reject characters XML 1.0 does not allow.

Preparing tool…
Try a small example

Try a small example

Load the fictional example in a cleared form. Check the options, run the tool if needed, and compare the result below.

Encode the five predefined XML characters for use inside an element’s text content. Paste literal text for between an XML element’s opening and closing tags, for example A & B < C. Select Escape for XML text. The tool encodes ampersands, angle brackets, double quotes and apostrophes; it rejects characters XML 1.0 does not allow. It does not build or validate a complete XML document, and existing entity references are encoded again. XML 1.0 forbids some control characters and invalid Unicode code points; those inputs are rejected. This tool does not build or validate a complete XML document or escape every other context. Quotes are encoded too, though they do not need escaping in text content. Existing entity references are encoded again.

Text for XML element content

<item name="Demo">Tea & coffee</item>

Expected output

&lt;item name=&quot;Demo&quot;&gt;Tea &amp; coffee&lt;/item&gt;

The example is unavailable until the tool is ready.

Text is processed in your browser.

✓ Local processing✓ No account✓ Inputs processed here✓ Free

Quick answer

Encode the five predefined XML characters for use inside an element’s text content.

The page and its assets load from the site; this operation uses your entered values only in this browser and does not send them to a calculation endpoint.

How to use it

Paste literal text for between an XML element’s opening and closing tags, for example A & B < C. Select Escape for XML text. The tool encodes ampersands, angle brackets, double quotes and apostrophes; it rejects characters XML 1.0 does not allow. It does not build or validate a complete XML document, and existing entity references are encoded again.

Limits

XML 1.0 forbids some control characters and invalid Unicode code points; those inputs are rejected. This tool does not build or validate a complete XML document or escape every other context. Quotes are encoded too, though they do not need escaping in text content. Existing entity references are encoded again.

Frequently asked questions

Which characters are escaped?

The tool encodes &, <, >, double quotes, and apostrophes as XML character references. An existing reference such as &amp; is encoded again because its ampersand is treated as text.

Where should I use the result?

Use it for text between an XML element’s opening and closing tags. It does not build or validate an XML document, and attribute values need context-appropriate escaping.

Sources and references

These references document the cited standard or browser API; they do not validate the tool’s output.