HTML Entity Encoder and Decoder

Encode or decode character references and inspect a live text preview as you type.

On-device No sign-up Free to use

Convert the entities controls

Showing an example. Edit to see your own.

?

Paste the text to encode, or the text containing references to decode. The work happens in this browser.

?

Used when encoding. Decoding reads named, decimal and hexadecimal references whatever style is chosen here.

?

Used by decimal and hexadecimal encoding. Named mode already encodes non-ASCII characters with a supported name or numeric fallback.

?

Used when decoding. A missing semicolon, an unlisted name and an impossible code point are reported with their position.

Processed in your browser. Your inputs stay on this device.

Result

Showing an example.

Encode the ampersand and angle brackets in Bread & butter <today>.

Encoded 3 of 22 characters as named references where one exists. The result is text, so paste it where the characters should show rather than run.

Loading the tool. Your result will appear here.

https://usefreetools.net/html-entity-encoder-decoder · 20 November 2026

Was this helpful?

How to use HTML Entity Encoder and Decoder

  1. Choose the Direction: text to references, or references to text.
  2. Paste the text in Text.
  3. For encoding, pick a Reference style: named, decimal or hexadecimal.
  4. 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>.

You add
Direction: encode; Text: Bread & butter <today>; Reference style: named; Also encode accented letters and other non-ASCII characters: false; When a reference is unknown or malformed: leave
You get
Encoded 3 of 22 characters as named references where one exists. The result is text, so paste it where the characters should show rather than run.

Options

Reference style
Named uses the tool's known names, such as &amp; and &copy;, with decimal references for other encoded non-ASCII characters. Decimal and hexadecimal styles write forms such as &#38; and &#x26;.
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 &#151; 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 &amp;lt; give me &lt; 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 &#151; 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.

Page updated · Project managed by Tony Hines · Report a problem with HTML Entity Encoder and Decoder