⚡deftools.io Developer Tools

HTML Entity Encoder

Encode and decode HTML entities. Convert special characters to named, decimal, or hex references and back.

or Ctrl+Enter · updates live
Quick Reference
& & (ampersand)
&lt; < (less than)
&gt; > (greater than)
&quot; " (quote)
&#39; ' (apostrophe)
&copy; © (copyright)
&nbsp;   (space)
&trade; ™ (trademark)

About this tool

HTML entities are named or numeric codes that represent characters which would otherwise be parsed as HTML markup: the angle brackets < and >, the ampersand &, and non-ASCII characters like © or —. Encoding them prevents browsers from interpreting user-supplied text as live HTML.

Example: pasting <a href="x">Tom & Jerry</a> and choosing Decode yields the rendered text <a href="x">Tom & Jerry</a>. Going the other way, 5 < 7 encodes to 5 &lt; 7 for safe display inside a code block.

Useful when sanitising pasted text for email templates, templating engines, or anywhere a literal < must survive a round trip through HTML.

FAQ

What is the difference between &lt; and numeric 60? ›

Both represent the same character (<). The named form is &lt;; the decimal numeric reference is &#60; and the hexadecimal one is &#x3C;. Named entities are easier to read; numeric references work for any Unicode code point that has no name.

Does this escape single and double quotes? ›

It encodes &quot; and &apos; alongside &lt;, &gt;, and &amp;. That covers the five characters the HTML5 spec marks as unsafe in text content and attributes.

Can it decode entities from older HTML pages? ›

Yes. The decoder recognises the common HTML4 named entities (&nbsp;, &copy;, &mdash; and others) plus all numeric references, and leaves unknown entities untouched.

How is this different from the String Escape tool's HTML mode? ›

The <a href="/string-escape">String Escape / Unescape</a> tool offers a quick HTML escape for the five primary special characters across multiple formats (HTML, URL, JSON, Regex, C-string, Base64) in one place. This tool is dedicated to HTML entities — it encodes and decodes the full set of named entities, decimal references, and hex references, with per-character control over the output format.

More developer tools

Copied!