Input
Encoded Output
When to use HTML entities
HTML entities are required whenever you need to display characters that have special meaning in HTML. The five essential ones are & (&), < (<), > (>), " ("), and ' (').
Without encoding, a < character in content will be interpreted as the start of an HTML tag, breaking your markup. Encoding is critical when rendering user-generated content to prevent cross-site scripting (XSS) attacks.
Named entities are more readable (© for ©), while numeric entities work for any Unicode character regardless of browser support for named versions.