HTML Entity Encoder / Decoder

Convert characters to HTML entities (amp, lt, gt, quot, #39 and numeric #xNN) and back, with a per-character mapping table.

Result<div class="note">Tom & Jerry say: "It’s <fun>!"</div>
Per-character mapping
CharacterEntity
<&lt;
"&quot;
"&quot;
>&gt;
&&amp;
"&quot;
’&#x2019;
<&lt;
>&gt;
"&quot;
<&lt;
>&gt;

What is it

Inside HTML, a handful of characters have reserved jobs: < and > open tags, & starts an entity, quotes delimit attributes. To show them as plain text you write entities instead: & becomes &amp;, < becomes &lt;, > becomes &gt;, " becomes &quot;, apostrophe becomes &#39;. Non-Latin characters can also be written as numeric entities like &#x4E2D;. This tool converts both ways and shows exactly which character became what.

Notes & fun facts

The classic bug: you write <span> inside a blog post and the browser swallows half the paragraph because it thinks the < opened a tag. The fix is replacing it with &lt;. Fun fact: browsers are forgiving and often render a bare & followed by letters anyway, but as soon as you have a string like &copy; or &nbsp; in your text, the entity engine kicks in and surprises you.

Origin & history

Character entity references came from SGML in the 1980s and were carried into HTML 2.0 (RFC 1866, 1995), which defined the core set such as amp, lt and gt. HTML 3.2 (1997) and HTML 4.0 (1999) expanded the named list, and today HTML5 defines over 200 named entities — everything from &copy; to &emoji; no, not really the emoji, but close.

Keep a kind heart, hold integrity as your foundation, and cherish warm love; may the world know peace and humanity live in harmony.
持善良之心,守正直之本,怀温暖之爱;愿世界和平,人间祥和。