HTML entity encoder and decoder

Encode HTML punctuation or decode semicolon-terminated references, with local processing, a text preview and complete copy and download.

Processing stays in the browser without uploads or automatic saving. Input: 128 KiB of UTF-8 and 131,072 UTF-16 units; output: 1 MiB. When decoding, numeric references have up to 32 digits; one local worker has a 5-second deadline and explicit cancellation.

Encoding replaces only &, <, > and both quotation marks, leaving Unicode and control characters literal. HTML decoding requires ; and runs once; unknown or incomplete references remain text. This is not XML processing, HTML validation or sanitization.

HTML entity input

How to use

Choose text encoding or HTML entity decoding, then paste text or select a UTF-8 TXT file. Process and review the preview and its limits. Copy the complete result or download a TXT file. Editing input or options invalidates the previous result; output never replaces input. After oversized text or incomplete Unicode is rejected, processing the old text stays blocked until that text is edited; changing operation or source does not clear the rejection, while an independent valid file can still run. The native clipboard may normalize line endings depending on the browser and system, while TXT preserves the result’s literal UTF-8 bytes and line endings.

Try an example

Encoding <p title="x">عربي & 'text'</p> gives &lt;p title=&quot;x&quot;&gt;عربي &amp; &apos;text&apos;&lt;/p&gt;. Decoding &amp;lt; once gives &lt;, while &unknown; and &amp without ; stay unchanged. The reference &#128; produces €.

Support & limits

Encoding replaces only &, <, > and the double and single quotation marks, using &apos; for the apostrophe, while leaving Unicode and controls literal. Decoding uses HTML rules with required ; and one pass, not XML rules or HTML validation. Unknown and incomplete references remain text; different spellings may produce the same character, so original entity spelling is not preserved. &#0;, &#xD800; and &#x110000; become U+FFFD, and &#128; becomes €. Literal isolated Unicode surrogate units are rejected. Files retain BOM, CRLF and NUL; the browser textarea may normalize line endings to LF. When NUL occurs, copying uses a quoted, escaped JSON string while TXT download keeps the raw UTF-8 bytes. Output is never executed, uploaded, saved or copied automatically.

Common questions

Does the result become safe to insert into any page or program?

No. This is a text conversion tool, not a sanitizer; decoding may produce HTML punctuation that looks like code. It is displayed here only as text. JavaScript, CSS and URL contexts need appropriate handling in the application using the text. There is no HTML preview, legacy or attribute mode, or blanket ASCII conversion.

Related tools