HTML Decoder

Turn the character references this page encodes back into characters.

Use this tool

Result

The result appears in this panel after you run the tool.

About this tool

The decoder reverses the encoder’s set: the escaped ampersand, less-than, greater-than, quote, and apostrophe, plus numeric references in that same set.

An unknown name such as a rare named entity is copied through. The text is not rendered, so a tag in the result does not run.

How to use it

  1. Paste the encoded text.
  2. Decode HTML.
  3. Copy the characters. An entity this page does not know is left unchanged.

Limitations

Unknown names stay, bad code points throw

Which references are rewritten

The decoder scans for an ampersand, a body, and a semicolon. The body may be a name or a numeric form in decimal or hex. Five names are recognized, without regard to case: amp, lt, gt, quot, and apos. A numeric hex body after #x or #X, and a decimal body after #, become a code point when the number is finite. Anything else that matched the shape, including an unrecognized name, is left as the original entity text. An ampersand with no semicolon is not a match, so it stays.

That is wider than the encoder. The encoder only writes five replacements, and it writes the apostrophe as a numeric reference. This page also accepts the named apostrophe form, and it accepts numeric references the encoder never emits, including letters and symbols outside that set of five. Decoding is still not decryption. The mapping is public. A successful result does not mean the text is safe to assign to innerHTML. The panel shows characters. It does not parse them as a document, but if you later inject the result as HTML, tags that were encoded will be tags again.

Failures the encoder never hits

Ordinary input never makes the encoder fail. This page can. A numeric reference whose code point is outside Unicode, or a surrogate code point, makes fromCodePoint throw, and the panel shows the error rather than a partial string. A truncated entity without a semicolon does not throw; it is copied. A name this table does not know, including many entities that browsers would render, is also copied, so the result can still contain ampersands. That silent leftover is the usual miss. If you expected a rare name to become a character, look for the entity still sitting in the output.

One layer, and a spelling change

Each run removes one layer. A double-encoded less-than, written so the ampersand itself is escaped, becomes a single less-than entity, not the character. Run again to finish. Starting from ' or from the named apostrophe both yield the same character, and re-encoding writes ', so the original name is not preserved. Hex and decimal numeric forms that decode to the same character also collapse to that character. The identity you get back is the character, not the source spelling of the reference.

Privacy

Your input is processed in your browser and is not uploaded to UtilChain. File names, text, and results are not sent to analytics.