Text and Decimal HTML References

Represent text as decimal character references such as A, or turn those references back into readable text. This converter handles the decimal form only: ordinary text and other escape formats stay in place when decoding.

Runs locally in your browser

Convert a decimal representation

Enter a text block or a mixture of text and decimal references. Conversion happens in browser JavaScript without sending the input in conversion requests. Results are displayed as plain text, not rendered as HTML.

  1. Encode A你😀 to obtain A你😀. Letters, spaces and punctuation are encoded too, not just non-ASCII characters.
  2. For decoding, paste references that start with &#, contain decimal digits and end with a semicolon. For example, left A right becomes left A right.
  3. Copy the result. To convert it again, paste it into the input. Editing the input or encountering an error clears the old output; Clear empties both input and result.

Decimal references, not every Unicode escape

One number for a complete code point

An emoji such as 😀 is represented by 😀, not separate references for its two UTF-16 surrogate units. The older pair �� is invalid here and is rejected rather than silently reassembled.

Only &# followed by decimal digits and a semicolon is decoded. Hex references such as A, named entities such as &, backslash escapes such as \u0041, bare numbers and incomplete &#65 remain literal. Use the separate ASCII or Unicode tools when you need their additional formats.

Replacement is deliberately single-pass

Decoding A gives the literal text A, not A. Unmatched text before and after references is preserved. This is a token converter, not a parser or validator for a complete HTML document.

Recognized decimal references use the strict checks in he 1.2.0. NUL, disallowed control values, surrogate values and out-of-range numbers can cause errors; �, € and � are examples. Encoding also rejects disallowed HTML characters and isolated surrogates. No partial result is kept after a failure.

Questions about decimal references

Are spaces and line endings preserved exactly?

The converter does not trim spaces or normalize Unicode. A space encodes as   and LF as 
. However, the input field changes actual CR and CRLF line endings to LF. The core can encode CR as 
, but strict numeric decoding rejects 
, so an exact round trip is not promised for every input.

Why does decoding sometimes leave the input unchanged?

Text with no supported decimal references is normally returned unchanged, including an empty input. The decoded result must still contain no unpaired surrogate characters; the literal escape \uD800 is not such a character and stays unchanged. A recognized decimal reference can fail strict validation. The page does not convert UTF-8 byte arrays or Java-style Unicode escapes, despite its legacy Native / Unicode name.

Recent tools: