How to use it
- Choose “Encode” or “Decode”.
- Type or paste the text; the result appears as you type.
- To encode, choose what to replace: only the special characters, or also every non-ASCII character as a name or a number.
- Copy the result, or swap it into the input to go the other way.
Rules and limits
How text is encoded and decoded
- Encode, minimal:
&,<,>,"and'become&,<,>,"and', exactly as Python’shtml.escapewrites them; without quotes only the first three. - Encode, also non-ASCII: every character above U+007F becomes its shortest name (
,€), a decimal number (€) or a hex number (€); characters without a name are written as hex numbers. The C1 controls U+0080 to U+009F stay as they are, because browsers read€as € (Windows-1252), not as U+0080. - Decode, as the HTML standard reads references in text: its 2,231 names, 106 old ones also without
;(&,©), always the longest name that fits (¬inis ¬ and “in”); numbers in decimal or hex, with�, surrogates and numbers above U+10FFFF as U+FFFD and€toŸas Windows-1252 characters; an unknown name stays as written. - In attribute values browsers leave an old name without
;alone when a letter, digit or=follows (?a=1©=2). This page decodes as in text, so check such links by hand.
Tested limits
- Checked against Python 3.14’s
html.unescapeandhtml.escape: the page’s name table equals Python’s HTML5 table; 20,000 adversarial texts (pieces of names with and without;, old names followed by letters, numbers with leading zeros or past U+10FFFF, surrogates, C1 controls, stray&) decode the same, except that Python leaves out references to controls and noncharacters such as, which the standard keeps; 10,000 random texts from every Unicode plane encode ashtml.escapedoes and, as names, decimal or hex numbers, decode back to the same text. In headless Chrome 157, 5,000 random texts decode exactly as Chrome’s own HTML parser reads them, and the attribute rule above was seen there too. - At most 2,097,152 characters. In Node.js 24 on the test laptop, encoding 2,097,151 characters (half of them Chinese) as names and numbers took 1.1 s, and decoding 2,097,152 characters with 262,144 references 0.5 s. The result box shows the first 20,000 characters; Copy and Download give all of it. In headless Chrome, a 1 MB text was shown encoded as names 2.1–6.1 s after the input in three runs with other jobs on the laptop (0.2 s of it the typing pause).
Questions and answers
Which characters must be escaped in HTML?
In text, & and < are enough; in an attribute value, also the quote that encloses it. Escaping >, " and ' everywhere, as the minimal option does, is the habit that never leaves a gap.
Why does © without a semicolon still become ©?
© without a semicolon still become ©?Old pages often left the semicolon out, so the standard keeps 106 old names that browsers still read without it. Newer names need it: &hellip stays as text, while … becomes …
Should I encode every non-ASCII character?
Not for a page saved as UTF-8, which holds every character as it is. Names or numbers help where the text must stay ASCII, for example in some e-mail templates or old systems, and they make invisible characters such as no-break spaces visible.
Is my text sent anywhere?
No. The text is converted in your browser and the page sends nothing. Only the chosen direction and options are remembered in this tab, not the text.