Skip to main content

HTML Entity Encoder / Decoder

Convert special characters to HTML entities and back

Using named entities like < >

Only encoding special HTML characters

Input
Result

Common HTML Entities Reference:

CharacterNamed EntityNumeric Entity
&&&
<&lt;&#60;
>&gt;&#62;
"&quot;&#34;
'&apos;&#39;
(space)&nbsp;&#160;
©&copy;&#169;
®&reg;&#174;
&trade;&#8482;
&euro;&#8364;
£&pound;&#163;
&mdash;&#8212;

What are HTML Entities?

HTML entities are special codes used to display characters that have special meaning in HTML or characters that cannot be easily typed on a keyboard. They begin with an ampersand (&) and end with a semicolon (;). For example, the less-than sign (<) is written as &lt; to prevent browsers from interpreting it as the start of an HTML tag.

Why Use HTML Entities?

  • Reserved Characters: Characters like <, >, &, and " have special meaning in HTML. Using entities prevents parsing errors and security vulnerabilities.
  • Special Symbols: Display symbols like copyright, trademark, or currency symbols that may not be available on all keyboards.
  • Character Encoding: Ensure proper display of characters across different browsers and systems, regardless of the document encoding.
  • Security: Prevent XSS (Cross-Site Scripting) attacks by encoding user input before displaying it in HTML.

Named vs Numeric Entities

HTML entities come in two formats:

  • Named Entities: Use memorable names like &copy; for the copyright symbol. These are easier to read but not all characters have named entities.
  • Numeric Entities: Use the Unicode code point in decimal or hexadecimal format. These work for any Unicode character.

Essential HTML Entities

The most important entities to know are: &lt; for less-than (<), &gt; for greater-than (>), &amp; for ampersand (&), &quot; for double quotes ("), and &apos; for apostrophe (').

Tip: Always encode user-generated content before inserting it into HTML to prevent XSS vulnerabilities.