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
<becomes<, the less-than sign>becomes>, the greater-than sign&becomes&, the ampersand"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
| Character | Entity | Notes |
|---|---|---|
| < | < | Less than |
| > | > | Greater than |
| & | & | Ampersand |
| " | " | Double quote |