Encode and decode HTML entities. Convert special characters for safe HTML display.
HTML entities are special codes like & and < that represent reserved or special characters in HTML. They prevent browsers from misinterpreting text as markup and protect against XSS attacks.
| Char | Entity | Description |
|---|---|---|
| & | & | Ampersand |
| < | < | Less than |
| > | > | Greater than |
| " | " | Double quote |
| ' | ' | Single quote |
| ␣ | | Non-breaking space |
| © | © | Copyright |
| ® | ® | Registered |
| ™ | ™ | Trademark |
| € | € | Euro |
| £ | £ | Pound |
| ° | ° | Degree |
These characters must always be encoded in HTML to prevent parsing errors:
XSS Prevention: Always encode user input before displaying it in HTML to prevent cross-site scripting attacks.
Formula
Named: &name; | Decimal: &#NNNN; | Hex: &#xHHHH; | Encoding: char → HTML_ENTITIES[char] || &#charCode;&name; = Named entity — human-readable (e.g., &copy; = ©)
&#NNNN; = Decimal numeric entity — Unicode code point in base 10
&#xHHHH; = Hexadecimal numeric entity — Unicode code point in base 16
charCode = Character's Unicode code point, obtained via charCodeAt(0)
Worked Example
Encode: <div class="hello">
Did you know? The five characters <, >, &, ", and ' are the only ones that must always be HTML-encoded. All other special characters (©, €, etc.) can be used directly in UTF-8 documents without encoding.
Sources
Convert text to ASCII codes and back. Supports decimal, hex, binary, and octal formats.
Convert width/height to aspect ratios, scale dimensions, and generate responsive embed CSS for any layout.
Calculate required internet bandwidth based on devices and activities in your household.
Encode and decode Base64 strings. Convert text for data URIs, APIs, and safe data transmission.
Create CSS border-radius with visual controls for each corner. Generate circles, pills, and custom shapes.
Create CSS box shadows with multiple layers, live preview, and copy-ready code.