tool hub Tool Hub

HTML Entity Converter

HTML Entity Converter — runs in your browser. Inputs are not stored.

Runs in your browser No sign-up Free to use


HTML entity converter

Enter values, then press Calculate.

How to use

  1. Put an HTML fragment or a sentence that already contains entities in Text.
  2. Encode turns & < > and double/single quotes into entities. Single quote becomes &#39;.
  3. Decode turns named entities and &#…; / &#x…; numeric entities back into characters.
  4. The result appears in the box below. Only one direction is applied at a time.
  5. Reset clears input and output. Conversion runs only in the browser.
  6. To show code as literal text on a blog, paste the encoded result so tags do not run. Encode an already-encoded sentence only once.

Key concepts

HTML entities write characters that would otherwise be parsed as tags. Encode replaces & first to reduce double escaping, then angle brackets and quotes. Single quote is &#39;. Use this as a first-pass escape when putting sample code in a CMS preview—not as a full sanitizer or DOMPurify replacement.

Named decode understands only amp, lt, gt, quot, apos, and nbsp. Other names are left as-is; numeric &#…; / &#x…; become code points. nbsp is U+00A0 (non-breaking space), not a normal space, so alignment can look odd after copy. Input is not sent to a server. When posting sample HTML on a forum, paste the encoded string so tags do not execute.

Example

Encode <div class="x"> and brackets/quotes show as &lt; &quot;, so pasting into source does not open a tag. Decode that string and tag-like characters return. &nbsp; is a hard-to-see special space. Encoding an already-encoded sentence once more yields &amp;lt;. Diff the text before and after decode to see which characters came back, line by line.

Related: Markdown preview · Unicode converter · Find and replace

Frequently asked questions

Which characters does HTML entity encoding change?

<code>& < ></code> plus double and single quotes. Other Unicode such as Hangul and emoji is left as-is for readability.

Are all named HTML entities decoded?

Only the common names amp, lt, gt, quot, apos, and nbsp. For other names, numeric entities are more reliable.

Are numeric entities decoded?

Decimal <code>&#…;</code> and hex <code>&#x…;</code> are supported. Invalid code points keep the original entity.

How do I use this with Markdown?

Escape sample code as entities, then check rendering in Markdown preview. Scripts stay escaped and do not run.

What if I double-encode?

You may see <code>&amp;lt;</code>. Check whether the source is already entities, and encode only once.

Is conversion stored on a server?

No. Encode and decode only change strings in the browser and do not save them.

HTML Entity Converter cover image
Your input is not sent to the server and disappears when you close the page.

Last reviewed: 2026-09-04