Skip to main content
NeatUtility

XML Entities Encoder & Decoder

XML & Markup100% Client-Side
Ready
TEXT
0 lines0 chars
0 B
About this tool, examples & FAQ

Encode reserved XML characters into the five W3C predefined XML entities (&, <, >, ", ') or numeric character references (hex and decimal). Decode XML entities back into raw characters with 100% in-browser privacy.

Key facts

Verified capabilities and limits of this utility
XML SpecificationW3C Extensible Markup Language (XML) 1.0 (Fifth Edition) §4.6
Predefined Entities&amp; (&), &lt; (<), &gt; (>), &quot; ("), &apos; (')
Maximum Input2 MB
Execution Deadline3 s

How to use

  1. Select your target operation: Encode XML Entities or Decode XML Entities.
  2. Choose quote escaping options: Both Quotes, Double Quotes Only, Single Quotes Only, or Neither.
  3. Configure non-ASCII handling: keep raw UTF-8 characters or convert to numeric character references.
  4. Paste your XML markup or text into the input pane and click Run (or press Ctrl/Cmd + Enter).
  5. Click Swap at any time to reverse the operation direction.

Examples

Encode reserved XML markup characters

Input

<note title="Terms & Conditions">Price < $10</note>

Example output

&lt;note title=&quot;Terms &amp; Conditions&quot;&gt;Price &lt; $10&lt;/note&gt;

Decode predefined and numeric XML entities

Input

&lt;data attr=&quot;val&quot;&gt;A &amp; B &#8364;&lt;/data&gt;

Example output

<data attr="val">A & B €</data>

Edge cases

Predefined Entities vs HTML Entities

Unlike HTML5, which recognizes over 2,000 named character references (like &copy; or &euro;), XML 1.0 strictly defines only five predefined entities. Any non-ASCII character must either remain raw UTF-8 or be encoded as a numeric character reference (&#...;).

Attribute vs Element Content Quoting

Double quotes (&quot;) and apostrophes (&apos;) only strictly require escaping when contained within XML attribute values delimited by that same quotation mark. This tool allows customizing quote escaping styles to preserve clean text readability.

Strict Numeric Character Reference Decoding

Both decimal (&#65;) and hexadecimal (&#x41;) character references are parsed and validated according to Unicode code point constraints, discarding invalid surrogate halves.

How it works

  1. Scans the input string character-by-character, evaluating Unicode scalar values.
  2. Replaces ampersands, angle brackets, and quotes with their respective XML predefined entities.
  3. Decodes matching predefined entity tags and numeric character references via regular expression tokenization.
  4. Executes client-side in a Web Worker without network requests or telemetry.

Frequently asked questions

What are the five predefined XML entities?

The five predefined entities in XML 1.0 are &amp; (ampersand &), &lt; (less-than <), &gt; (greater-than >), &quot; (straight double quote "), and &apos; (straight apostrophe/single quote ').

Can I use HTML entities like &copy; in an XML document?

No, unless they are explicitly declared in the XML Document Type Definition (DTD). Without a DTD declaration, an XML parser will fail with an undefined entity fatal error. Use numeric character references like &#169; or &#xA9; instead.

Is my XML content private?

Yes. All processing runs locally inside your browser via web workers. No input text or results are sent to remote servers.

References