HTML Entity Encoder / Decoder

Encode special characters to HTML entities or decode entities back to characters. Searchable reference table included.

What are HTML Entities?

HTML entities are special character sequences that represent characters with meaning in HTML. For example, &lt; represents < and &amp; represents &. Encoding prevents browsers from interpreting these characters as HTML tags or attributes. This tool encodes and decodes HTML entities, including named entities, numeric references, and Unicode characters.

Common Use Cases

  • Encoding user input to prevent XSS (Cross-Site Scripting)
  • Displaying code snippets with < and > in HTML pages
  • Inserting special characters like ©, ®, and ™ in HTML
  • Decoding HTML entities found in web scraping results
  • Encoding strings for safe display in HTML email templates

Frequently Asked Questions

When do I need to use HTML entities?

Always encode <, >, &, ", and ' when displaying user-generated content in HTML to prevent XSS attacks. Also use entities for special characters that aren't on your keyboard, like mathematical symbols, accented characters, and emoji.

What is the difference between named and numeric entities?

Named entities use readable names: &amp; &lt; &copy;. Numeric entities use Unicode code points: &#38; &#60; &#169;. Named entities are easier to read but not all characters have names. Numeric entities work for any Unicode character.