Encoding / Decoding

HTML Entity Encode

Encode or decode HTML entities for safe HTML output.

Original Text
HTML Entities

Common HTML Entities

&&
&lt;<
&gt;>
&quot;"
&#39;'
&nbsp;(space)
&copy;©
&reg;®
&trade;
&euro;
&pound;£
&yen;¥
&deg;°
&plusmn;±
&times;×
&divide;÷
&frac12;½
&frac14;¼
&frac34;¾

What is HTML Entity Encoding?

HTML entity encoding converts special characters to HTML entity references, ensuring they display correctly in HTML documents without being interpreted as HTML tags.

Features

  • Two-way conversion: Encode and decode modes
  • Basic encoding: Encodes special characters (<, >, &, ")
  • Full encoding: Converts all characters to numeric entities ({)
  • Entity reference: Common HTML entity lookup table

Common Entities

  • &lt; - Less than (<)
  • &gt; - Greater than (>)
  • &amp; - Ampersand (&)
  • &nbsp; - Non-breaking space
  • &copy; - Copyright (©)

Use Cases

  • XSS Prevention: Encode user input to prevent XSS attacks
  • HTML Escaping: Display HTML code as text
  • Special Symbols: Display copyright, trademark symbols in HTML

Frequently Asked Questions

When are HTML entities actually required?
Three cases: displaying characters that would parse as markup (<, >, &), using quotes inside attribute values, and typing characters not on your keyboard (like © for ©). HTML5 also allows raw UTF-8 characters wherever they cause no ambiguity.
What is the difference between & and &?
The rendered result is identical. Named entities are readable but limited to the names HTML defines; numeric entities (decimal & or hexadecimal &) can express any Unicode code point. A practical use of numeric entities is keeping email addresses from being collected literally by scrapers.
Why does a correctly decoded entity still show as a box or mojibake?
The decoding is fine — the problem is the font or charset: the page is not served as UTF-8, or the font lacks the glyph. Confirm the code point with this tool first, then check the page charset and font coverage.