Productivity and Utilities

HTML Entity Encoder and Decoder

Choose encode or decode, then paste your text to see the converted result.

Up to 500,000 characters. Nothing is uploaded.

Used when encoding.

Markup characters are & < > " and the apostrophe.

Encoding replaces the characters & < > " and the apostrophe so the text is safe inside HTML, and can also replace every character above code 127. Named entities use the 252 names of the HTML 4 set, such as &eacute; and &copy;, and any other character becomes a number. Decoding reads entities that end in a semicolon: names from that set, decimal numbers such as &#8364; and hex numbers such as &#x20AC;. Numbers 128 to 159 are read as the Windows-1252 characters browsers use, and 0, surrogates and numbers past U+10FFFF become the replacement character. A name that is not known is left as typed and counted. Nothing is uploaded from this page.

Next step

How to use the html entity encoder and decoder

  1. Choose Encode to entities or Decode to characters.
  2. Paste your text in the box.
  3. When encoding, choose named, decimal or hex entities, and whether to replace only the markup characters or every character above 127.
  4. Read the result and the table of replacements, then copy it or download it.

Formula

& becomes &amp;, < becomes &lt;, > becomes &gt;, " becomes &quot; and ' becomes &#39;

Named: &eacute;. Decimal: &#233;. Hex: &#xE9;

Decoding reads &name; from the HTML 4 set, &#decimal; and &#xhex;

Numbers 128 to 159 are read as the Windows-1252 characters browsers use, and 0, surrogates and values past U+10FFFF become the replacement character.

Encoding a short line

The line Café & <b>naïve</b> 5 € © 2026 has 30 characters. With Markup characters only, it becomes Café &amp; &lt;b&gt;naïve&lt;/b&gt; 5 € © 2026, with five replacements. With Plus all non-ASCII and named entities it becomes Caf&eacute; &amp; &lt;b&gt;na&iuml;ve&lt;/b&gt; 5 &euro; &copy; 2026, with nine replacements.

With hex entities the same line is Caf&#xE9; &#x26; &#x3C;b&#x3E;na&#xEF;ve&#x3C;/b&#x3E; 5 &#x20AC; &#xA9; 2026. Decoding Caf&eacute; &amp; &lt;b&gt; 5 &#8364; &#x1F600; &foo; returns Café & <b> 5 € and a smiling face, and leaves &foo; as typed because it is not a known name.

When entities are needed

In HTML the characters &, < and > have meaning, so to show them as text you write them as entities. Inside an attribute value, the quote that closes the value has to be an entity as well. Encoding the apostrophe makes the text safe inside attributes that use either kind of quote. Characters above 127 do not need entities if the page declares UTF-8, but they are sometimes encoded when text passes through systems that handle only ASCII.

Entities are not a defense by themselves. Which characters to encode depends on where the text goes: body text, an attribute, a script or a URL each have their own rules. See the String Escape and Unescape tool for other escaping styles, and the URL Encoder and Decoder for addresses.

Named, decimal and hex

Named entities are easiest to read, and the 252 names in the HTML 4 set work everywhere. Characters with no name become a number. Decimal and hex forms always work and point at the Unicode code point, which you can look up with the Unicode Code Point Converter. To turn a whole page into text, use the HTML to Text Converter.

Assumptions and limits

  • Only entities that end in a semicolon are decoded. Older forms such as &amp without the semicolon are left as typed.
  • Names come from the HTML 4 set. Newer HTML 5 names that are not in it are left as typed and counted.
  • The names lang and rang decode to the angle brackets U+27E8 and U+27E9, as browsers do.
  • Encoding handles one code point at a time, so an emoji with several parts becomes several entities.

Formulas reviewed October 10, 2026. See the calculation methodology for how SumPanda rounds, tests and sources its formulas.

Frequently asked questions

Why is the apostrophe always a number?

The name &apos; is not part of HTML 4 and is not read by every old browser, so &#39; is the safe choice.

What does it mean when an entity is left as typed?

The name is not in the set the tool knows, or the entity does not end with a semicolon. The count of those is shown so you can check them.

Should I encode every non-ASCII character?

Not if the page is UTF-8, which most are. It is mainly useful for systems that cannot handle anything above ASCII.

What do numbers 128 to 159 mean?

Browsers read them as the Windows-1252 characters, so &#150; becomes an en dash and &#128; becomes the euro sign.