HTML Entity Encoder / Decoder — Online & Free

Convert special characters to HTML entities and back. Supports named, decimal, and hexadecimal entities. All processing happens in your browser — no data sent to any server.

Text to HTML Entities

HTML Entities to Text

What Are HTML Entities?

HTML entities are special codes used to represent characters that have reserved meaning in HTML or that cannot be easily typed on a keyboard. Every entity starts with an ampersand (&) and ends with a semicolon (;). For example, the less-than symbol < is written as &lt; in HTML.

Entities exist because HTML markup uses certain characters for syntax. If you want to display a literal less-than sign in a paragraph, you cannot simply type < — the browser would interpret it as the start of a tag. You must use the entity &lt; instead.

There are three types of HTML entities:

  • Named entities: Use a human-readable name, such as &amp; for &, &copy; for ©, and &nbsp; for a non-breaking space
  • Decimal entities: Use the Unicode code point in decimal, such as &#60; for < and &#169; for ©
  • Hexadecimal entities: Use the Unicode code point in hexadecimal with an x prefix, such as &#x3C; for < and &#xA9; for ©

Common HTML Entity Reference

Character Named Decimal Hexadecimal Description
&&amp;&#38;&#x26;Ampersand
<&lt;&#60;&#x3C;Less than
>&gt;&#62;&#x3E;Greater than
"&quot;&#34;&#x22;Double quote
'&apos;&#39;&#x27;Single quote
&nbsp;&#160;&#xA0;Non-breaking space
©&copy;&#169;&#xA9;Copyright
®&reg;&#174;&#xAE;Registered
&trade;&#8482;&#x2122;Trademark
&euro;&#8364;&#x20AC;Euro sign
£&pound;&#163;&#xA3;Pound sign
¥&yen;&#165;&#xA5;Yen sign
&larr;&#8592;&#x2190;Left arrow
&uarr;&#8593;&#x2191;Up arrow
&rarr;&#8594;&#x2192;Right arrow
&darr;&#8595;&#x2193;Down arrow

When to Encode HTML Entities

  • Displaying code in HTML: If you write a tutorial showing HTML markup, you must encode angle brackets so the browser renders them as text instead of parsing them as tags
  • Form inputs and dynamic content: When rendering user-generated content, encoding prevents XSS attacks by ensuring potentially malicious scripts are displayed as text rather than executed
  • Attribute values: If an HTML attribute value contains quotes, encode them to prevent breaking the attribute syntax
  • Special characters in text: Characters like copyright symbols, em dashes, and non-breaking spaces may need entity encoding for compatibility with older parsers
  • Email templates: Many email clients handle raw Unicode inconsistently; entity encoding improves cross-client rendering
  • XML compatibility: XML is stricter than HTML about certain characters; encoding ensures valid XML output

Frequently Asked Questions

Is this HTML entity tool free?

Yes, completely free. No signup, no usage limits, no API calls. Everything runs in your browser.

Does this tool send my data to a server?

No. All encoding and decoding happens 100% client-side in your browser using JavaScript. Your data never leaves your machine.

What is the difference between named, decimal, and hexadecimal entities?

All three represent the same character. Named entities are human-readable (e.g., &lt;). Decimal entities use the character's Unicode number in base 10 (e.g., &#60;). Hexadecimal entities use base 16 with an x prefix (e.g., &#x3C;). Named entities are easiest to read; decimal and hexadecimal can represent any Unicode character.

Should I encode quotes in my HTML?

Encode quotes when they appear inside HTML attribute values that use the same type of quote. For example, if your attribute uses double quotes, encode any double quotes inside the value. In regular text content, quotes do not need encoding.

Can I encode all non-ASCII characters?

Yes. Enable the "Encode all non-ASCII" option to convert every character outside the basic ASCII range (letters, numbers, and common symbols) into its decimal entity equivalent. This is useful for maximum compatibility with legacy systems.

Does the decoder handle malformed entities?

The decoder attempts to parse all standard entity formats. If it encounters an entity it does not recognize, it leaves it unchanged in the output rather than throwing an error.