Skip to content
SmaftyTools

HTML Entity Encoder

Encode special characters as HTML entities or decode entities back to text. Handles named, decimal and hex entities.

About HTML Entity Encoder

The HTML Entity Encoder is a free html entity encoder that converts special characters — <, >, &, quotes — into their HTML entity equivalents, and decodes entities back to plain text. It's the tool to reach for any time you need to escape html safely, whether you're a developer, technical writer or anyone pasting code or foreign text into a web page.

Encoding matters whenever text could be mistaken for markup: showing a code snippet inside a blog post, rendering user-submitted comments without letting them break your layout (or worse, inject a script), or writing documentation that literally contains characters like < and &. Skip the encoding step and a browser will try to parse your text as HTML — the classic symptom is a webpage where part of the content mysteriously disappears because it was interpreted as a tag. The decode direction is just as useful: pasted content from CMSs, RSS feeds or old databases often arrives full of entities like &amp; and &#39; that need to become normal text again. It's also a common step when preparing text for RSS feeds, email templates and legacy CMS platforms that store content in an ASCII-safe, entity-encoded form rather than raw UTF-8.

The decoder understands all three entity forms: named entities (&amp;, &copy;, &mdash; and dozens more from the HTML spec), decimal numeric references (&#233;), and hexadecimal numeric references (&#xE9;) — so it doesn't matter which form your source data used. An optional numeric-encoding mode escapes every non-ASCII character, not just the five HTML-critical ones, which is useful for systems that mangle raw UTF-8 or older email templates that only support ASCII. Common named entities like &nbsp; (non-breaking space), &trade; and &euro; are recognized alongside the handful most developers already know, so pasted content from word processors and design tools decodes cleanly instead of leaving mystery entity codes behind.

Conversion is instant and entirely client-side.

How to Use the HTML Entity Encoder

  1. Choose Encode or Decode mode.
  2. Paste your text or entity-encoded HTML.
  3. Copy the converted result.

Features

  • Encodes the five HTML-critical characters (& < > " ')
  • Optional numeric encoding of all non-ASCII characters
  • Decodes named, decimal and hex entities
  • Instant, client-side conversion

Examples

Encoding a code snippet for safe display

Input

<div class="box">Tom & Jerry</div>

Output

&lt;div class=&quot;box&quot;&gt;Tom &amp; Jerry&lt;/div&gt;

Decoding entities from a CMS export

Input

Caf&eacute; &amp; Bar &mdash; est. 1990

Output

Café & Bar — est. 1990

Frequently Asked Questions

When do I need HTML entities?

Whenever text could be interpreted as markup: showing code snippets on a page, inserting user content into HTML, or writing characters like < and & in documentation. Encoding prevents broken layouts and XSS injection.

What's the difference between &#233; and &#xE9;?

Both represent é. &#233; uses the decimal code point; &#xE9; uses hexadecimal. Browsers accept either form.

Does this tool decode HTML entities too?

Yes — switch to Decode mode and paste text containing named (&amp;), decimal (&#233;) or hexadecimal (&#xE9;) entities; all three forms convert back to plain text in one pass.

Is the HTML Entity Encoder free?

Yes, the HTML Entity Encoder is completely free with no usage limits. No signup, no account and no installation required.

Is my data safe?

Yes. All processing happens locally in your browser using JavaScript — nothing you type is uploaded or stored on our servers.