HTML Entity Encoder & Decoder
Turn characters such as <, >, & and quotes into HTML entities so they display safely inside a page, or decode entities like & and é back into readable text. You can also write every non-ASCII character as a named, decimal or hexadecimal reference. The result is always shown as plain text, never inserted as markup, and nothing leaves your browser.
Result
- Unknown references
- Output characters
Examples
The references people look for most often:
| Entity | Character | Meaning |
|---|---|---|
& | & | ampersand |
< | < | less-than sign |
> | > | greater-than sign |
" | " | double quote |
| U+00A0 | non-breaking space |
© | ยฉ | copyright sign |
€ | โฌ | euro sign |
… | โฆ | ellipsis |
Formula & Methodology
An HTML character reference starts with & and ends with ;. It can be a name (&), a decimal code point (&) or a hexadecimal code point (&). Encoding replaces & < > " and ' with their references; the other styles also replace characters outside basic ASCII. Decoding follows the HTML5 rules, including the references that browsers accept.
& & &Encoding for HTML text is not the same as encoding for a URL (use the URL tool) or for JavaScript strings.
Notes and limitations
- Decoded output is displayed as text. This tool never inserts your text into the page as HTML.
- References without a semicolon (such as &) are decoded only for the few legacy names that browsers still accept.
- Escaping & < > " ' makes text safe inside HTML text and quoted attributes. It does not make text safe inside script, style or unquoted attributes.
- Characters outside the Basic Multilingual Plane (such as emoji) are written as one reference for the whole character.
- The limit is two million characters.
How to Use
- Choose to encode text or to decode entities.
- Paste or type your text. For encoding, pick how far to go beyond the five special characters.
- Read the result and any notes about unknown or doubly encoded references.
- Copy the result or download it.
Frequently Asked Questions
Which characters must be encoded in HTML?
Always the ampersand and the less-than sign in text, and the quote character used around an attribute value. Encoding the greater-than sign and both quote types as well is a safe habit.
What is the difference between named, decimal and hexadecimal references?
They all stand for the same character. é, é and é each produce รฉ. Named references are easiest to read; numeric ones work for every character, including those without a name.
Why does decoding leave some text unchanged?
A reference must be a valid HTML entity. Text such as &foobar; is not one, so it stays as written and is counted as an unknown reference.
Is it safe to decode untrusted text here?
Yes. The decoded result is shown as text with no markup parsing. Only paste decoded text into a page after encoding it again.
Is anything sent to a server?
No. Encoding and decoding run in your browser, and nothing you enter is uploaded or sent to analytics.
Last updated: