>_ MoriDev dev.moritools.com
HTML5 Entities 100% Client-Side · Zero Upload

HTML Entities & Special Characters Encoder / Decoder

Encode reserved HTML markup characters and non-ASCII symbols to named, decimal, or hex entities—or decode entity-escaped markup cleanly.

Ready (Offline)
Quick Summary

Escape raw <, >, &, ", and ' markup into safe HTML5 entities (with optional non-ASCII numeric decimal or hex encoding) or decode named and numeric entities like &mdash; and &#x1F680; back into readable UTF-8 text.

Interpolating unescaped user strings into HTML emails, RSS XML feeds, or server-rendered templates opens immediate Cross-Site Scripting (XSS) vulnerabilities and breaks attribute boundaries whenever text contains quotes or ampersands.

Conversely, scraped metadata, CMS exports, and RSS titles frequently arrive littered with &amp;quot; double-encoding or numeric code points like &#8217;. This tool handles both minimal security-safe escaping and full non-ASCII entity conversion in either direction.

HTML Escaping & Encoding Pitfalls

01. Forgetting Single Quotes (&#39;) Inside HTML Attributes

Escaping only <, >, and " leaves single-quoted attributes like title='user input' vulnerable to attribute breakout. Always encode apostrophes as &#39; (avoid &apos; for legacy HTML4/email clients).

02. Double-Escaping Ampersands (&amp;amp;)

Running an encoder twice over already-escaped copy converts &copy; into &amp;copy;, rendering literal entity code on screen. Decode once to inspect the real underlying string before re-encoding.

03. Using HTML Entities Inside JavaScript or CSS Contexts

HTML entity encoding protects HTML element body and attribute contexts only. Placing HTML-encoded text inside a <script> block or inline onclick handler does not stop JS injection—use JSON serialization instead.

Core Reserved HTML5 Character Entities

Character Named / Safe Entity Numeric Hex
& (Ampersand) &amp; &#x26; — must always be escaped first
< (Less Than) &lt; &#x3C; — prevents opening arbitrary tags
> (Greater Than) &gt; &#x3E; — closes tag injection payloads
" (Double Quote) &quot; &#x22; — secures double-quoted attributes
' (Apostrophe) &#39; &#x27; — safer than &apos; in old mailers

Worked Engineering Examples

Neutralizing an Injected Script Tag

Input
<img src="x" onerror="alert(1)">
Output
&lt;img src=&quot;x&quot; onerror=&quot;alert(1)&quot;&gt;

Browsers display the string verbatim as harmless text instead of executing the onerror attribute.

Decoding Numeric Unicode Emoji & Typography

Input
Launch &mdash; 100% Ready &#x1F680;
Output
Launch — 100% Ready 🚀

Resolves named entities, decimal NCRs, and supplementary-plane hexadecimal code points via String.fromCodePoint.

Frequently Asked Questions

Should I encode non-ASCII characters like Chinese or Emoji as HTML entities?

If your page declares <meta charset="utf-8">, raw UTF-8 characters are smaller and cleaner. Turn on Encode Non-ASCII only for legacy ISO-8859-1 email gateways or ASCII-only XML pipelines.

Why does the encoder emit &#39; instead of &apos;?

Although HTML5 and XML support &apos;, older email clients and HTML4 parsers fail to decode it. Numeric &#39; works universally across every browser and mail client.

Does the decoder handle supplementary Unicode emoji like &#x1F600;?

Yes. Code points above U+FFFF are decoded with String.fromCodePoint after validating the 0x0–0x10FFFF Unicode range.

How do I fix double-escaped RSS titles like Tom &amp;amp; Jerry?

Paste the string in Decode mode once to get Tom &amp; Jerry, click Swap, and decode a second time to restore Tom & Jerry.

Continue Your Workflow

24 offline developer utilities