How to use HTML Entity Encoder and Decoder
- Choose the Direction: text to references, or references to text.
- Paste the text in Text.
- For encoding, pick a Reference style: named, decimal or hexadecimal.
- The encoded or decoded text updates as you change the input and mode. Check characters such as ampersands and angle brackets before copying it.
Example: HTML Entity Encoder and Decoder
Encode the ampersand and angle brackets in Bread & butter <today>.
Options
- Reference style
- Named uses the tool's known names, such as & and ©, with decimal references for other encoded non-ASCII characters. Decimal and hexadecimal styles write forms such as & and &.
- Also encode accented letters and other non-ASCII characters
- This switch affects decimal and hexadecimal encoding. Named mode already encodes non-ASCII characters using a supported name or decimal fallback.
- When a reference is unknown or malformed
- Used when decoding. Leave it keeps the source as typed and lists the problems. Stop and report the first one suits a typo hunt.
- Direction
- For HTML Entity Encoder and Decoder, choose Text to references, References to text.
- Text
- Paste the text to encode, or the text containing references to decode. The work happens in this browser.
Supported inputs and limits
- Up to 200,000 characters in one run.
- Names cover 34 common references; every other character the named style writes becomes a decimal number.
- Decoding reads named, decimal and hexadecimal references whatever style you chose.
- Numeric references are checked first, so a value outside the Unicode range, a surrogate, a null or a control character is reported instead of written.
- The C1 range follows the HTML standard, which maps it through Windows-1252, so — decodes to an em dash.
More details
This is not a sanitizer: it gives you text, not a decision about where that text may go.
Live conversion uses the same bounded grammar as the main action.
Copy result copies the completed output; the live panel is a text preview.
Where your input is processed
This tool does not upload your inputs. See the limits for anything saved on your device.
Where the reference names come from
HTML defines more named references than this tool's set of 34. Its encoder covers common markup characters, punctuation, currency symbols, fractions and arrows; other encoded non-ASCII characters use numeric references. The decoder accepts only its documented bounded grammar, applies the stated numeric-code-point rules and reports unsupported names. Use the HTML standard when you need the complete reference list.
Questions about HTML Entity Encoder and Decoder
Is the decoded text safe to put straight into my page?
Decoding gives you characters. Whether they are safe depends on where they land, since element content, an attribute and a script block each have their own rules. Escape for that spot.
Why does decoding &lt; give me < instead of a less-than sign?
One pass removes one layer, so the outer reference became an ampersand and the letters lt. Run the decoder again if you want that layer, but check the value first.
Why is — shown as an em dash?
The HTML standard does not read that range as control codes. It maps those numbers through Windows-1252 first, so 151 becomes an em dash.
What happens to control characters?
Named style leaves them in the text as they are rather than writing a reference. On decode, a numeric reference that points at a control character, a null or a surrogate is reported with its position.