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 converted text updates as you change the fields. Copy the result or download the .txt file.
Example: HTML Entity Encoder and Decoder
Decode a single escaped reference.
Options
- Reference style
- Named writes a name where one exists, such as & and ©, and a decimal number for the rest. The numeric styles write numbers, which are easier to scan in a log.
- Also encode accented letters and other non-ASCII characters
- Used by the two numeric styles. Turning it on writes references for accented letters too. The named style already numbers any character it has no name for.
- 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.
Supported inputs and limits
Where your input is processed
This tool processes your input in this browser. Your text and files are not uploaded to UseFreeTools. Check this tool's limits for anything it may save on your device.
Where the reference names come from
Named references are fixed by the HTML standard, which holds far more names than the 34 this tool writes. The encoder keeps the ones people meet every day: the five characters that change meaning in markup, plus common punctuation, currency, fractions and arrows. Anything outside that list becomes a number instead, which is longer but always resolves.
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.