HTML Entity

Character references for representing special characters in HTML. Starts with & and ends with ;.

HTML entities are character references used to safely represent special characters in HTML documents. Common examples include &amp; (&), &lt; (<), and &gt; (>).

HTML entities come in two types: named references (&amp;) and numeric references (&#38;, &#x26;). Named references are more readable, while numeric references can directly specify Unicode code points. HTML/CSS fundamentals books cover the basics comprehensively.

For XSS prevention, when outputting user input to HTML, the five characters <, >, &, ", and ' must always be converted to entities.

From a character count perspective, entities display as one character but occupy multiple characters in source code. &amp; is 5 characters in source but displays as 1. Web frontend development books provide additional context.