HTML Entities Decoder

Converts HTML entities back into the characters they stand for — &amp;amp; to &, &amp;lt; to <, &amp;#39; to an apostrophe, &amp;nbsp; to a space. Useful when text has come out of a CMS, an RSS feed or a database with its markup escaping still attached.

Live demo · real result from this tool

Decoded text

<p>Café & crème brûlée 🍮</p>

Processed on your device — nothing is uploaded.

How to use HTML Entities Decoder

  1. Paste the text containing HTML entities.
  2. The decoded text appears immediately.
  3. If entities remain in the output, it was double-encoded — run the result through again.
  4. Named, decimal and hexadecimal entities are all recognised.
  5. &nbsp; becomes a non-breaking space, not a regular one — they look identical and compare differently.
  6. Decoding runs in your browser; content is not uploaded.

Why entities exist at all

Four characters cannot appear literally in HTML where they would be read as markup: <, >, & and, inside attributes, the quote characters. Escaping them as entities is what stops a user’s comment containing a script tag from becoming a script tag — it is the foundation of cross-site scripting defence. Entities also cover characters that are hard to type or invisible, such as &nbsp; for a non-breaking space and &mdash; for an em dash.

Double encoding, and how to recognise it

Seeing &amp;lt; in your output means the text was escaped twice: the & of &lt; was itself escaped. It happens when text passes through two layers that each escape defensively — a CMS that escapes on save and a template that escapes on render. Decoding once gives you &lt;; decoding again gives you <. The fix in the code is to escape at exactly one layer, normally at output, and never at storage.

Named, decimal and hexadecimal forms

The same character can be written three ways: &amp;, &#38; and &#x26; are all an ampersand. Named entities are readable but only cover a defined list; numeric forms work for any Unicode code point, which is why exported content often uses them for anything beyond ASCII. This decoder handles all three. Note that only &amp;, &lt;, &gt;, &quot; and &apos; are defined in XML — an XML parser will reject &nbsp;, which is a common surprise when HTML content is pasted into an XML feed.

The non-breaking space problem

&nbsp; decodes to U+00A0, which looks exactly like an ordinary space and behaves differently: it does not collapse, does not break a line, and does not match a space in a search or a comparison. Text pasted from a web page is full of them, and they are the usual reason two apparently identical strings do not match, or a whitespace cleaner leaves double spaces behind. Convert them explicitly if you are cleaning text for storage.

Frequently asked questions

Which HTML entities are decoded?
All standard named entities (&amp;, <, >, ", etc.) plus numeric &#NNN; and hex &#xNNN; forms.
Can I decode HTML source code?
Yes — paste any HTML and all entities within it will be decoded to their visible characters.
Is this safe to use on untrusted HTML?
Yes — decoding entities is safe. Never inject decoded output back into live HTML without sanitization.
What does &amp;nbsp; mean?
A non-breaking space: a space that browsers will not collapse with its neighbours and will not break a line at. It is used to keep “10 kg” or “Mr Smith” together. It decodes to a real character, U+00A0, which is not the same as the ordinary space you type.
Why do I still see &amp;amp; after decoding?
The text was encoded twice. Decode it a second time and the remaining entities resolve. In code, the cure is to escape at exactly one point in the pipeline rather than defensively at several.
Is HTML decoding safe?
Decoding text is safe. Inserting decoded text back into a page is not — that is precisely how cross-site scripting works. Decode for reading and processing; re-escape before rendering, and never assign decoded user content to innerHTML.

Written by the ToolsRift team · Last updated

Pages are drafted with AI assistance and checked by automated tests. How we write and check pages.

Was this tool useful?

Report a problem

Start typing to search every tool.

↑ ↓ to moveEnter to openEsc to close