HTML Entities encode/decode

Encode or decode text with htmlentities. No key needed, fully reversible, and nothing leaves your browser.

Runs in your browser
Character by character

Which characters become entities

Characters with a meaning in HTML (& < > " ') always become entities. So do all characters that HTML 4.01 has a name for, such as ü, é, © or €. Everything else, including emoji, stays as it is.

<&lt;3cbb62>&gt;3eTT54oo6fmm6d␣␣20&&amp;26␣␣20JJ4aee65rr72rr72yy79<&lt;3c//2fbb62>&gt;3e

18 bytes in, 34 characters out: +89 %

Typing in the tool above fills this in. Nothing leaves your browser.

In short

What is HTML entities?

HTML entities replace characters that have a meaning in HTML, or that a page can't show, with a reference such as &lt; for < or &uuml; for ü. Encoding them stops user input from breaking a page or injecting markup. This tool works like PHP's htmlentities() with the 252 named entities of HTML 4.01.

Not encryptionAnyone can decode it, no key needed. It changes the format, not who can read it. Encoding vs hashing vs encryption →
Where you meet it
  • Showing user input on a web page
  • Code examples in HTML
  • Old pages in ISO-8859-1
  • RSS feeds and HTML e-mail
  • Template and CMS output
Check & decode

Why won't my HTML entities decode?

Paste what you have. The check tells you what is wrong, what kind of data is inside and shows the decoded result.

Examples:
  • Paste text above or try an example.
Every form at once

htmlentities, htmlspecialchars and numeric

The same input in the forms you meet in practice. Shown for <b>Tom & Jerry</b>; type in the box above or in the tool to use your text.

htmlentitieswhat the tool returns
&lt;b&gt;Tom &amp; Jerry&lt;/b&gt;
htmlspecialcharsonly & < > " ' – enough with UTF-8
&lt;b&gt;Tom &amp; Jerry&lt;/b&gt;
Numeric, decimalworks in HTML and XML
&#60;b&#62;Tom &#38; Jerry&#60;/b&#62;
Numeric, hexworks in HTML and XML
&#x3C;b&#x3E;Tom &#x26; Jerry&#x3C;/b&#x3E;
Use it in code

The same result in your code

Every snippet encodes <b>Tom & Jerry</b> to &lt;b&gt;Tom &amp; Jerry&lt;/b&gt; exactly like the tool, then decodes it back. They are run and compared with the tool before each release.

PHP
echo htmlentities('<b>Tom & Jerry</b>'), "\n";
echo html_entity_decode('&lt;b&gt;Tom &amp; Jerry&lt;/b&gt;'), "\n";

Python, JavaScript, Java and Go have no built-in function with PHP's full entity table. Python's html.escape() and Go's html.EscapeString() only replace & < > " ', like htmlspecialchars(), which is all a UTF-8 page needs. For decoding, Python's html.unescape() knows every HTML5 entity.

Test values

HTML entities examples and test values

What the tool returns for these inputs (UTF-8). Use them to check your own code. ↵ marks a line break.

InputHTML entities
<b>Tom & Jerry</b>&lt;b&gt;Tom &amp; Jerry&lt;/b&gt;
"double" and 'single'&quot;double&quot; and &#039;single&#039;
Grüße aus MünchenGr&uuml;&szlig;e aus M&uuml;nchen
© 2026 · €5 → 10&copy; 2026 &middot; &euro;5 &rarr; 10
naïve caféna&iuml;ve caf&eacute;
🙂🙂
Common mistakes

Why your HTML entities doesn't match

Encoded twice: &amp;amp;

If a page shows &amp; or &lt;b&gt;, the text was encoded twice. Template engines (Twig, Blade, Jinja, React) escape on their own; encode only once, at output.

htmlentities or htmlspecialchars?

With UTF-8 pages only & < > " ' have to be replaced. htmlentities() also turns ü into &uuml;, which makes text longer and harder to search. htmlspecialchars() is usually the better choice; compare both below.

Not enough inside &lt;script&gt; or URLs

Entities protect HTML text and quoted attributes. They don't protect values inside <script>, onclick or href="javascript:…". Use JSON encoding for JavaScript and URL encoding for links.

&amp;apos; is not HTML 4

&apos; comes from XML and HTML5. PHP's HTML 4.01 mode writes ' as &#039; and leaves &apos; undecoded.

Missing semicolon

&auml without ; is not decoded by PHP. Browsers guess some names without semicolon, which is why text can look fine in the browser and wrong in your data.

The tool trims and uses CRLF

Like the form on the original site, the tool removes spaces and line breaks at the start and end, and sends line breaks as CRLF (\r\n). That is why a result can differ from your code by one line break.

FAQ

Questions about HTML entities

What is the difference between htmlentities and htmlspecialchars?

htmlspecialchars only replaces & < > " and ', which is all a UTF-8 page needs. htmlentities also replaces every character that has a named entity, such as ü with &uuml; and € with &euro;.

Does htmlentities prevent XSS?

In HTML text and in quoted attribute values, yes. It does not protect values inside <script>, event handlers like onclick or javascript: URLs. Those need JSON or URL encoding and a content security policy.

Why does my page show &amp;amp;?

The text was encoded twice: the & of &amp; was encoded again. Usually a template engine escapes on its own and the code encodes as well. Encode once, at output.

Which entities does this tool know?

The 252 named entities of HTML 4.01, plus numeric ones like &#252; and &#xFC;, exactly like PHP's htmlentities() and html_entity_decode() in HTML 4.01 mode.

Good to know

Before you rely on it

Searches the list of pages on this site. What you type stays in your browser.