HTML Entity Encode
Encode special characters into HTML entities like &, <, and > instantly in your browser. Safely insert text into HTML source, show a code sample in documentation, or convert emoji and non-Latin text into numeric character references.
Usage examples
Safely inserting text into HTML source
Before dropping user-entered text straight into an HTML document, convert characters like &, <, and > into entities so they don't break the markup.
Showing a code sample in documentation
When you want to display an HTML/XML snippet as literal text in a blog post or doc, encode it first so the browser doesn't interpret it as real tags.
Converting emoji or non-Latin text into numeric entities
Turn on 'Also encode all non-ASCII characters' to convert emoji or characters like 日本語 into numeric references such as 日.
Preparing user-generated content for an XML feed
Encode titles or descriptions pulled from a database before inserting them into an RSS or Atom XML feed, so characters like & and < don't produce invalid XML.
Embedding a code snippet inside an HTML attribute
Encode a string like 'data-tooltip="5 > 3"' before writing it into an HTML attribute value, so the greater-than sign doesn't get misread as the start of a new tag.
Quick reference
Reserved HTML characters
| Character | Unicode | HTML entity |
|---|---|---|
| & | U+0026 | & |
| < | U+003C | < |
| > | U+003E | > |
| " | U+0022 | " |
| ' | U+0027 | ' |
Also encode all non-ASCII characters
| Character | Unicode | HTML entity |
|---|---|---|
| © | U+00A9 | © |
| ® | U+00AE | ® |
| ™ | U+2122 | ™ |
| € | U+20AC | € |
| £ | U+00A3 | £ |
| ¥ | U+00A5 | ¥ |
| ° | U+00B0 | ° |
| ± | U+00B1 | ± |
| × | U+00D7 | × |
| ÷ | U+00F7 | ÷ |
| — | U+2014 | — |
| – | U+2013 | – |
| … | U+2026 | … |
| • | U+2022 | • |
| é | U+00E9 | é |
| ñ | U+00F1 | ñ |
| ü | U+00FC | ü |
| ß | U+00DF | ß |
| → | U+2192 | → |
| ♥ | U+2665 | ♥ |
| 😀 | U+1F600 | 😀 |
Frequently asked questions
Is my text sent to a server?
No. All encoding happens entirely in your browser, and what you enter is never sent to a server.
Is there any risk of a script executing?
No. Your input is treated purely as a string — each special character is simply replaced with its entity — so it's never parsed or executed as real HTML.
Which characters are encoded by default?
The five characters with special meaning in HTML — &, <, >, ", and ' — are encoded by default.
Can I decode entities too?
Yes — use the 'HTML Entity Decode' tool for the reverse conversion.
Does encoding my text protect against XSS attacks by itself?
Encoding the five special HTML characters is one important layer, since it stops injected text from being interpreted as tags or attributes. But a fully secure application also needs context-aware output encoding, a Content Security Policy, and server-side validation — this tool handles the character-escaping part, not the full security picture.
Why would I encode non-ASCII characters that already display fine in HTML?
Modern browsers handle UTF-8 text like emoji and non-Latin scripts without any encoding. Numeric entity encoding is mainly useful when a downstream system doesn't reliably support UTF-8, such as older email clients, certain legacy CMS fields, or strict ASCII-only data pipelines.
What's the difference between a named entity like & and a numeric one like &?
Both represent the exact same character — an ampersand, in this example. Named entities are easier for humans to read, while numeric entities work for any Unicode character, including ones that don't have a short mnemonic name. This tool outputs named entities for the five basic characters and numeric entities when the non-ASCII option is enabled.