Pro Calculators and Guides

How to Encode and Decode HTML Entities (& < > and More)

Turn special characters into HTML entities so text shows correctly in a web page, or decode entities back to normal text.

Saizul Amin
Saizul Amin15 Oct 2026 · Updated 17 Oct 2026 · 1 min read
How to Encode and Decode HTML Entities (& < > and More)

HTML treats <, > and & as part of its own syntax. If you want to show them as text, you must write them as entities: &lt;, &gt; and &amp;. Forgetting this breaks pages and can even create security problems.

Quick answer

Choose Encode to convert special characters to entities, or Decode to turn entities back into characters. Tick the extra option to encode every non-ASCII character too.

The characters that matter

CharacterEntityWhy
&&amp;starts an entity
<&lt;starts a tag
>&gt;ends a tag
"&quot;inside attributes
'&#39;inside attributes
non-breaking space&nbsp;prevents wrapping

Steps

  1. Paste your text.
  2. Pick Encode or Decode.
  3. Copy the result.

Example

<p>Tom & "Jerry"</p> encodes to &lt;p&gt;Tom &amp; &quot;Jerry&quot;&lt;/p&gt;, which shows as the original text in a page.

Why it matters

  • Showing code in a tutorial.
  • Preventing broken pages when user text contains <.
  • Security: failing to encode user input can enable cross-site scripting (XSS). Always encode output in your application, not only in a tool.
  • Email templates and CMS fields that expect HTML.

Tips

  • Encode only once; double-encoding shows &amp;lt; on the page.
  • If you use a template engine, it may encode for you automatically.
  • For URLs, use URL encoding, which is a different thing.
Completely freeNo cost, no sign-up
Files stay privateEverything runs in your browser
Easy in your languageAvailable in many languages