HTML Numeric Entity Encoder/Decoder

Convert characters to   decimal or   hex entities

Ad placeholder (leaderboard)

Numeric HTML entities reference characters by their Unicode code point rather than by name, so any character at all can be written in pure ASCII. This tool encodes text to decimal or hexadecimal numeric references and decodes them back.

How it works

Encoding reads each Unicode code point of the input and emits it as a numeric reference in the base you choose:

decimal:  char -> &#<codePoint>;     "A" -> &#65;    " " -> &#160;
hex:      char -> &#x<HEXcodePoint>; "A" -> &#x41;   " " -> &#xA0;

Because it works on full code points (via the string iterator), characters above U+FFFF such as emoji become one entity, not a broken surrogate pair. Decoding parses &#NN; and &#xNN;, converts the number to a code point, and rebuilds the original character with String.fromCodePoint.

Example and notes

The word café encoded as decimal becomes &#99;&#97;&#102;&#233;, and the non-breaking space U+00A0 becomes &#xA0; in hex. If you only need to make markup safe to display while keeping text human-readable, the named-entity tool is usually a better choice; numeric encoding shines when you need a fully ASCII-safe, encoding-independent representation.

Ad placeholder (rectangle)