Developer tools

HTML decoder
and entity encoder

Decode HTML entities back into plain text, or encode text as entities, in your browser. This HTML decoder turns &lt;p&gt;caf&eacute;&lt;/p&gt; into <p>café</p>. The encoder writes named, decimal or hexadecimal references for reserved characters, for non-ASCII text or for every character. Copy the result or download it as a .txt file.

Processed in your browser

Convert HTML entities

Conversion settings

Reserved characters are & < > and both quotes.

Input

The selected file is the input until you clear it. Its preview is read-only; convert to read it.

Choose an operation and convert your text. Empty text is valid.

Result

Each run converts once. Decoded markup stays plain text and is never rendered. HTML decoding replaces invalid numeric code points and remaps some legacy control references; see the rules below.

How to decode HTML online

Set Operation to Decode entities to text. Paste into the Input text box, or pick a file under Or choose a UTF-8 text file. Then choose a Decoding context and select Decode text.

The result appears in the Result (plain text) box. Copy result puts it on the clipboard, Download .txt saves it as html-entities-decode.txt, and Use as input moves it back into the input for another pass. For the reverse job, set Operation to Encode text to entities, pick an Entity format and Characters to encode, and select Encode text.

  1. Paste entities or choose UTF-8

    Use Input text, or select your text file with Choose File.

  2. Set the entity conversion

    Choose Operation and its format, character scope or decoding context. Select Encode text or Decode text.

  3. Copy or save the converted text

    Check Result (plain text), then select Copy result or Download .txt. Use as input prepares another pass.

Editing the input or changing a setting clears the old result. Reset empties the input and the result and sets every menu back to its first option.

Named, decimal and hex entities

An HTML character reference starts with & and ends with a semicolon when encoded. The encoder offers three Entity format options. With Reserved and non-ASCII selected, A <é 😀 becomes A &lt;&eacute; &#x1f600; in Named, A &#60;&#233; &#128512; in Decimal and A &#x3c;&#xe9; &#x1f600; in Hexadecimal.

Named format uses a name where HTML defines one, such as &nbsp;, &copy;, &euro; and &mdash;. A character without a name, such as the emoji, falls back to a hexadecimal reference. Decimal and hexadecimal write the Unicode code point, so é is 233 in decimal and e9 in hex.

Characters to encode sets the scope. Reserved only escapes & < > and both quotes, which is what HTML text and quoted attribute values need. Reserved and non-ASCII also escapes accents, symbols and emoji. All characters encodes letters, spaces and line breaks too, so Hi! becomes &#72;&#105;&#33; in decimal.

How the HTML decoder reads references

Decoding follows the rules browsers apply to HTML. &lt;p&gt;caf&eacute; &amp; tea&lt;/p&gt; becomes <p>café & tea</p>, and &#38;, &#x26; and &amp; all become &. The Decoding context decides what happens to a reference that has no closing semicolon.

HTML text decodes old names without the semicolon, as a page body does. &copy 2026 becomes © 2026, and &notit; becomes ¬it;, because &not is a complete legacy name. HTML attribute value keeps such a name literal when a letter, a digit or = follows it, so the link text ?a=1&copy=2 stays as written. Semicolon required decodes only references that end in a semicolon, so &copy 2026 and &#60p stay unchanged.

Names are case-sensitive, so &AMP; decodes and &Amp; does not. An unknown name such as &foo; stays as typed in every context.

Double encoding and invalid references

Each run decodes once. Double-encoded text such as &amp;amp;lt; becomes &amp;lt;, not <. Select Use as input and decode again to remove the next layer. Encoding also runs once, so encoding &amp; gives &amp;amp;.

Some numeric references name no usable character, and HTML replaces them. &#0;, a surrogate such as &#xD800; and anything above &#x10FFFF; all become the replacement character �. Most references from 128 to 159 map to the Windows-1252 characters that old pages meant, so &#128; becomes € and &#153; becomes ™.

Those rules mean a few encoded results cannot decode back to the original. When you encode a NUL or one of those control characters, the line under the result adds a warning that the text will not round-trip through HTML decoding. Nothing in the result is trimmed or Unicode-normalized, and the line says so when the output matches the input.

Limits

The tool converts text only. It never renders, runs or fetches the markup it decodes, and both boxes show plain text. Decoding can rebuild working tags such as <script>, so treat the result as code before you paste it into a page. Encoding suits HTML text and quoted attribute values; it does not make text safe inside JavaScript, CSS, URLs or unquoted attributes.

It does not decode percent-encoding such as %27, or Base64. Files must be valid UTF-8, and a file with other bytes gets an error that asks you to save it as UTF-8. Text with a lone surrogate half is refused, so a download never loses a character.

There is no fixed size limit. Browser memory decides what finishes. Cancel, shown while a run is in progress, stops it and keeps your input, and an error lets you retry when the browser runs out of memory.

UTF-8 files and line endings

Files must contain valid UTF-8; invalid byte sequences show an error. A leading BOM is preserved as a character and is encoded if selected by the character scope. No BOM is otherwise added. File conversion, Copy result and downloads preserve the actual line endings; text boxes display CR and CRLF as LF. Pasted input and Use as input also normalize line endings to LF. Literal unpaired surrogates are rejected to prevent a lossy UTF-8 download.

The result preview and file preview show Unicode line and paragraph separators as line breaks. Copy result and Download .txt preserve those original separators too.

After conversion, the labels under Input and Result count Unicode code points, including spaces and line endings. An emoji such as 😀 counts as one character; a letter and a separate combining accent count as two. File counts include the original BOM and each CR and LF, even when the text box displays them differently.

If clipboard access fails, the result stays selected for manual copy. Use your browser's copy command for the displayed text, or select Download .txt to save the exact converted text and its original line separators.

Questions

What is &#38; in HTML?

&#38; is the decimal character reference for the ampersand, code point 38. &#x26; is the same character in hexadecimal, and &amp; is its name. Paste any of them, choose Decode entities to text and select Decode text, and each one becomes &. Encoding & writes one of these three forms, depending on the Entity format.

What is %27 in HTML encoding?

%27 is not an HTML entity. It is URL percent-encoding for the apostrophe, used in links and query strings. The HTML decoder leaves %27 unchanged, because the HTML references for an apostrophe are &#39; and &apos;. To turn %27 back into an apostrophe, use the URL encoder and decoder linked below.

What are HTML entities?

HTML entities are references that stand for characters in HTML source. They start with & and usually end with a semicolon. A named entity uses a word, such as &eacute; for é. A numeric one uses the code point, in decimal as &#233; or in hexadecimal as &#xe9;. All three decode to the same character.

Some named entities decode to more than one Unicode code point. For example, &fjlig; becomes fj, which counts as two characters here.

How do I escape characters in HTML code?

Replace each reserved character with its entity: & becomes &amp;, < becomes &lt;, > becomes &gt;, a double quote becomes &quot; and an apostrophe becomes &apos;. Here, choose Encode text to entities, keep Reserved only and Named (hex fallback), paste your text and select Encode text to get all five at once.

Is my text uploaded?

No, conversion and file reading run in a background worker in your browser. Your text and file names are not uploaded, logged or put in browser storage. Copy result writes to your clipboard, and Download .txt saves a file only when you click it. Reset, or leaving the page, clears the input and the result.