Convert HTML entities to text
HTML entities to text conversion takes codes like ♥, ☺ or 🚀 and replaces them with the characters they stand for. It is ideal for cleaning up copy that was pasted from HTML source, CMS exports, product feeds or spreadsheet columns full of & codes.
Example
Input:
Café – “Naïve” ♥ ☺ 🚀 ™Output:
Café – “Naïve” ♥ ☺ 🚀 ™Named, decimal and hexadecimal codes can be mixed freely in the same text, as they are here; the converter handles each one independently.
Three kinds of entity code
| Form | Example | Meaning |
|---|---|---|
| Named | ♥ | A name from the HTML5 entity table |
| Decimal | ♥ | The Unicode code point in base 10 |
| Hexadecimal | ♥ | The Unicode code point in base 16 |
All three produce the same ♥. The converter supports every named entity in HTML5 and any numeric code point up to U+10FFFF, including emoji outside the Basic Multilingual Plane.
Cleaning up text for other uses
Entity codes are only meaningful inside HTML. Once text moves somewhere else — a spreadsheet, a JSON file, a mobile app, a PDF or a plain-text email — they appear literally. Converting them first gives you portable text:
- Product titles in a CSV export showing “Salt & Pepper”.
- Translations stored with entities that need to go into a JSON language file.
- Blog excerpts that show
’instead of an apostrophe on social media previews.
Spreadsheet programs do not decode entities, so if an imported column shows & or é, paste the column here, convert it and paste it back. In Python, html.unescape() does the same for a whole file.
If the output contains markup such as <p> after decoding, and you want only the words, pass it through the HTML Stripper next. To go from symbols to entity codes, use Text to HTML Entities.
Look-alike characters to watch after decoding
Several entities decode to characters that look almost the same as ordinary keyboard characters but compare differently in code, search and spreadsheets:
| Entity | Character | Easily confused with |
|---|---|---|
– / — | – / — | the hyphen-minus - |
− | − | the hyphen-minus -, so "−5" is not a number to Excel |
’ | ’ | the straight apostrophe ' |
× | × | the letter x |
 ,   | wider or narrower spaces | the normal space |
If a decoded value refuses to match a lookup or parse as a number, one of these is the usual suspect.
Things to keep in mind
decodes to a non-breaking space, which looks like a space but is a different character for search and comparison.- Double-encoded text (
&hearts;) needs two passes. - Codes without a trailing semicolon are decoded only where HTML5 allows it, just as in a browser.
The conversion takes place in your browser; your text is never uploaded.