Home › Code and dev › HTML Entity Encoder
🔧

HTML Entity Encoder

Encode and decode HTML entities, and turn HTML into JavaScript strings

选项设置
输入
输出结果

About this tool

The HTML entity tool converts between special characters and their entity forms:

  • Encode: turn < > & " ' and similar characters into HTML entities
  • Decode: turn entities back into characters
  • HTML to JS: convert markup into a JavaScript string, either concatenated or as a template literal
  • Scope: encode only special characters or all non-ASCII characters

Common entities

  • &lt; becomes <, the less-than sign
  • &gt; becomes >, the greater-than sign
  • &amp; becomes &, the ampersand
  • &quot; becomes ", the double quote

When to use it

  • Show code examples inside HTML without the tags being parsed
  • Reduce cross-site scripting risk
  • Build HTML strings in JavaScript
  • Process XML and HTML data

Entity reference

CharacterEntityNotes
<&lt;Less than
>&gt;Greater than
&&amp;Ampersand
"&quot;Double quote