Skip to content

XML Decoder

Decoded text —
References decoded
—
Distinct references
—
Characters before
—
Characters after
—

Paste escaped XML and the decoder replaces the five predefined entities and every numeric character reference with the real character. For example, <b>Tom & Jerry</b> becomes a literal bold tag around Tom & Jerry, with 5 references decoded. Anything XML does not define is left as it was and flagged.

About this tool

Log files, SOAP responses, RSS feeds and database exports often hold XML that has been escaped so it can sit inside another document. Reading it in that state is slow: every angle bracket is four characters and every accented letter may be a number. This decoder reverses the escaping for the five entities XML 1.0 predefines (lt, gt, amp, quot, apos) and for decimal and hexadecimal character references, then lists each reference it replaced and how often. It works in a single pass, exactly as an XML parser does, so text that was escaped twice comes out escaped once. HTML-only names such as nbsp or eacute are not part of XML without a DTD, so they are kept and reported rather than guessed.

How to use it

  1. Paste the escaped text

    Paste into the box or open a .txt or .xml file from your device; it is read locally.

  2. Read the decoded text

    The plain version appears as you type, along with how many references were replaced.

  3. Check the reference table

    Each distinct entity or code point is listed with the character it became and its count.

  4. Review any warning

    References XML does not define, or code points outside the allowed range, are kept and listed.

Examples

An escaped bold tag

Escaped XML text
<b>Tom & Jerry</b>

Result Decoded text: <b>Tom & Jerry</b>
References decoded: 5
Distinct references: 3
Characters before: 34
Characters after: 18

  1. Found 5 valid reference(s), 3 distinct.
  2. Named entities < > & " &apos; became < > & " '; &#N; and &#xH; became the character with that code point.
  3. Length went from 34 to 18 characters.

Five entities of three kinds turn back into a literal tag with an ampersand inside.

Decimal and hex character references

Escaped XML text
© 2024 €5

Result Decoded text: © 2024 €5
References decoded: 2
Distinct references: 2
Characters before: 21
Characters after: 9

  1. Found 2 valid reference(s), 2 distinct.
  2. Named entities < > & " &apos; became < > & " '; &#N; and &#xH; became the character with that code point.
  3. Length went from 21 to 9 characters.

© is decimal for the copyright sign and € is hexadecimal for the euro sign.

Text escaped twice

Escaped XML text
&lt;tag&gt;

Result Decoded text: <tag>
References decoded: 2
Distinct references: 1
Characters before: 19
Characters after: 11

  1. Found 2 valid reference(s), 1 distinct.
  2. Named entities < > & " &apos; became < > & " '; &#N; and &#xH; became the character with that code point.
  3. Length went from 19 to 11 characters.

One pass removes one layer, so doubly escaped markup comes out still escaped once; run the output through again to finish.

How it is calculated

&name; → predefined character; &#N; → code point N (decimal); &#xH; → code point H (hexadecimal)

name
one of lt, gt, amp, quot, apos
N, H
the Unicode code point in decimal or hexadecimal digits

The text is scanned once from left to right. Each reference ending in a semicolon is replaced if XML 1.0 defines it: the five predefined entities, or a numeric reference whose code point is a legal XML character (tab, line feed, carriage return, U+0020 to U+D7FF, U+E000 to U+FFFD, or U+10000 to U+10FFFF). Surrogates, control characters and unknown names stay untouched. Because the replacement is not repeated, &lt; yields < and not the bracket.

When not to use it

  • For HTML pages full of named entities like   or é, an HTML entity decoder covers the full HTML list.
  • For checking that a document is well-formed, a validating XML parser reports structure errors this decoder ignores.

Common mistakes

  • Expecting &lt; to become a bracket in one pass, when it correctly becomes < first.
  • Forgetting the closing semicolon, so &amp without it is not a reference and is left alone.
  • Pasting decoded text back into an XML attribute without escaping the quotes and ampersands again.

Frequently asked questions

Which named entities does XML recognise?

Only five without a DTD: < for the less-than sign, > for greater-than, & for the ampersand, " for the double quote and &apos; for the apostrophe. Everything else must be declared in a DTD or written as a numeric reference.

Why was   not converted?

It is an HTML entity, not an XML one. An XML parser without a DTD would reject it, so the decoder keeps it as typed and adds a warning. Its numeric form,  , is decoded.

What is the difference between © and ©?

Both point to U+00A9, the copyright sign. The first gives the code point in decimal, the second in hexadecimal after the x. Uppercase and lowercase hex digits are both accepted.

Why are some numeric references left unchanged?

XML 1.0 forbids most control characters, the UTF-16 surrogate range U+D800 to U+DFFF, and U+FFFE and U+FFFF. A reference to one of those is not a legal character, so it is kept as written and listed in the warning.

Does decoding change CDATA sections?

No special handling is applied. Inside a real CDATA section entities are literal text, so if your input contains CDATA blocks, decode only the parts outside them.

Is the text uploaded?

No. Decoding runs in your browser, and a file you open is read on your device without being sent anywhere.

Cite this tool

Using this tool in an assignment, article or report? Copy a citation, or a link for your website.

APA

Tools Directory Editorial Team. (2026, October 12). XML Decoder. Tools Directory. Retrieved October 26, 2026, from https://tools.milunir.com/converters/text-encoding/xml-decoder/

MLA

Tools Directory Editorial Team. “XML Decoder.” Tools Directory, 12 Oct. 2026, https://tools.milunir.com/converters/text-encoding/xml-decoder/. Accessed 26 Oct. 2026.

Chicago

Tools Directory Editorial Team. “XML Decoder.” Tools Directory. Last modified October 12, 2026. Accessed October 26, 2026. https://tools.milunir.com/converters/text-encoding/xml-decoder/.

Link<a href="https://tools.milunir.com/converters/text-encoding/xml-decoder/">XML Decoder – Tools Directory</a>