Calcoid
Tech

HTML Character Entities Encoder/Decoder

Encode text to HTML entities or decode entities back to characters. Safe-escape the 5 reserved chars, encode all non-ASCII, or decode named (&), decimal (A), and hex (A) entities. 150+ named-entity table.

HTML character entities encoder and decoder

Escapes only the 5 reserved characters: & < > " '

Named uses &amp; for &, falls back to decimal for chars without a name.

Runs locally in your browser. Nothing is sent to a server.

Frequently Asked Questions about the HTML Character Entities Encoder/Decoder

Which characters must I escape in HTML?
Five characters carry special meaning in HTML and have to be escaped when you want them to appear as literal text: ampersand (& becomes &amp;), less-than (< becomes &lt;), greater-than (> becomes &gt;), double quote (" becomes &quot;), and single quote (' becomes &apos;). The first three are non-negotiable inside any HTML body or attribute value. The two quotes only matter inside attribute values, but escaping all five is the safe default and what the "Encode (safe)" mode does. Skipping any of them inside user-supplied content is a classic XSS bug.
What is the difference between named, decimal, and hex entities?
All three refer to the same Unicode codepoint, just written differently. A named entity uses a memorable label between & and ; (for example &copy; for the copyright symbol). A decimal numeric entity uses &# followed by the codepoint in base 10 (&#169; for the same copyright). A hex numeric entity uses &#x followed by the codepoint in base 16 (&#xA9;). Named entities are easiest to read but exist only for the roughly 250 characters HTML5 defines names for. Numeric entities work for any of the 1.1 million Unicode codepoints, which is why the calculator falls back to decimal when no name exists.
Why does &apos; only work in XHTML, or does it work everywhere now?
&apos; was originally defined in XML and was not part of HTML 4, so older HTML 4 documents had to write the single quote as &#39; instead. HTML5 added &apos; to its named entity reference, so every modern browser accepts it without complaint. If you are generating HTML5 (the default since about 2014), &apos; is safe to use. If you are still producing strict HTML 4 documents or feeding content into a legacy XML/XHTML parser, stick with &#39; to stay portable.
How many HTML entities are there?
The HTML5 named character reference defines about 2,231 names, with some characters reachable by multiple aliases (for example &lt; and &LT;). This calculator ships a curated subset of around 150 names that covers everything you actually hit in normal content: the 5 reserved chars, whitespace, typography (quotes, dashes, ellipsis), currency, math, Greek letters, arrows, and card suits. For any character outside the curated list, the encoder automatically emits a numeric entity instead, so nothing falls through. Numeric entities (&#NNN; and &#xHH;) can address all 1,114,112 Unicode codepoints.
When should I use 'Encode all' instead of 'Encode (safe)'?
Use 'Encode all' when you need maximum compatibility with consumers that cannot be trusted to handle UTF-8, such as RSS or Atom feeds read by older aggregators, plain-text email pipelines that downgrade to ASCII, legacy CMS templates, or character-set-confused log parsers. It escapes every non-ASCII character plus the reserved 5, so the output is pure 7-bit ASCII and survives any encoding-mangling step in transit. For normal modern web pages that already declare UTF-8 in their charset, 'Encode (safe)' is enough and keeps the source readable.