Back to Developer
HTML entity encode / decode — &, <, > safely

HTML entity encode / decode — &, <, > safely

Encode HTML special characters (< > & " ') into entities like &amp;lt; and decode &amp;amp; back into &amp;. Toggle the direction in one click and optionally encode all non-ASCII characters as numeric references. Useful when pasting code samples into blogs, double-checking XSS escaping, or preparing HTML email bodies.

developerencodedecode

How to use

Pick a direction (Encode or Decode), paste your text, and press Convert. Encoding escapes the five HTML special characters <, >, &, ", and ' by default; enabling the non-ASCII option additionally converts every code-point above 127 into numeric references like &#xxxx;. Decoding handles both named entities (&lt;, &amp;, &nbsp;, etc.) and decimal/hex numeric references. Useful when pasting code samples into blogs, double-checking XSS escaping, formatting HTML email bodies, or unescaping CSV and log output.

FAQ

Is the text uploaded to a server?
No. Encoding and decoding happen entirely in your browser's JavaScript engine. Even strings with sensitive content stay local.
Which characters are encoded?
By default we escape the five HTML-syntax specials < (&lt;), > (&gt;), & (&amp;), " (&quot;), and ' (&#39;). Toggling Also encode non-ASCII additionally converts every character above U+007F to a decimal numeric reference, which helps when an email or document pipeline mangles UTF-8.
Which named entities does decode support?
We bundle the HTML5 named-entity list (over 250 entries including &lt;, &gt;, &amp;, &quot;, &apos;, &nbsp;, &copy;, etc.). Numeric references — decimal (&#65;) or hex (&#x41;) — can decode any Unicode code point.
How is this different from URL encoding?
URL encoding (percent-encoding) escapes reserved characters in URLs using %XX. HTML entity encoding handles HTML-syntax specials. They serve different purposes — use the URL encode/decode tool for URL handling.

Related tools