← Back to Blog

HTML Entity Encoder & Decoder: Quick Reference Guide

Published Jun 18, 2026 · 5 min read

HTML entities are a fundamental part of web development that every developer encounters. They're how you display reserved characters (<, >, &, ") in HTML without breaking the page structure. A good HTML entity encoder/decodermakes working with these characters effortless.

What Are HTML Entities?

HTML entities are codes that represent special characters. They always start with &and end with ;. There are two types:

  • Named entities: &lt;for <, &gt;for >
  • Numeric entities: &#60;for <, &#62;for >

When You Need to Encode HTML

User-Generated Content

If your app accepts user input and displays it on a web page, you mustHTML-encode that content. Failure to do so creates cross-site scripting (XSS) vulnerabilities. A user could submit <script>...</script>that executes on your site.

Code Examples in Blog Posts

When showing HTML code in a blog post (like this one), you need to encode the angle brackets so they display as text rather than being interpreted as HTML tags.

Email Templates

HTML email clients require encoding for special characters. Many email rendering engines are stricter than browsers about unescaped characters.

XML and RSS Feeds

XML uses the same encoding rules as HTML. Any content that contains <, >, or & must be encoded.

Common HTML Entities Reference

CharacterNamed EntityNumeric Entity
< (less than)&lt;&#60;
> (greater than)&gt;&#62;
& (ampersand)&amp;&#38;
" (double quote)&quot;&#34;
' (single quote)&apos;&#39;
© (copyright)&copy;&#169;
® (registered)&reg;&#174;
  (non-breaking space)&nbsp;&#160;
— (em dash)&mdash;&#8212;
… (ellipsis)&hellip;&#8230;

Using an HTML Entity Encoder/Decoder

Rather than memorizing every entity code, use an HTML entity encoder and decoder tool. Paste in your text, click encode, and all special characters are converted to their entity equivalents instantly. The decoder does the reverse — turn encoded text back into readable characters.

For related developer utilities, check out our JSON formatterfor formatting API data that may contain HTML content.

Encoding in Practice

Most modern frameworks (React, Vue, Angular) handle HTML entity encoding automatically when you use templates properly. However, when you're working with raw HTML strings, inserting content via innerHTML, or building email templates manually, you still need to encode explicitly.

Security note:Never insert user-generated content into a page without HTML encoding it first. This is the most common source of XSS vulnerabilities on the web.