HTML Entity Encoder & Decoder

Convert characters like <, >, & and quotes to safe HTML entities, or turn entities back into readable text.

Three modes

Essential encodes the five characters that matter in HTML: < > & and both quote marks. Full also encodes every non-ASCII character. Numeric writes entities as numbers, for example & becomes &#38;.

Why escape?

Displaying code or user text inside HTML requires escaping, otherwise the browser treats it as markup. Escaping is also a basic defence against cross-site scripting when text is shown on a page.

How to use it

  1. Choose the Mode.
  2. Paste text into Input.
  3. Press Encode or Decode and copy the output.

Encoding example

In Essential mode this input:

<b class="x">Tom & Jerry's</b>

becomes <b class="x">Tom &amp; Jerry&#39;s</b>.

Common use cases

Exactly what each mode outputs

All three modes work one character at a time. Essential replaces &, <, >, " and ' with &amp;, &lt;, &gt;, &quot; and &#39;. Full does the same and writes every character above code point 127 as a decimal numeric entity. Numeric converts every character, including letters and spaces. Verified on the text café — © 😀 <3 in Full mode:

caf&#233; &#8212; &#169; &#128512; &lt;3

Numeric mode on A&é gives &#65;&#38;&#233;. Emoji and other characters outside the basic plane come out as one entity for the whole code point, not two surrogate halves. The encoder never writes named entities such as &copy; or &nbsp;, only numeric ones.

How decoding behaves

Decoding hands your text to the browser's own HTML parser and returns the resulting text. That means it understands every named entity the browser knows (&copy;, &hellip;, &nbsp;), plus decimal and hexadecimal numeric entities. It also means any tags in the input are removed rather than preserved: decoding <b>x</b> &amp; y returns x & y. A non-breaking space decodes to a real U+00A0 character, which looks like a normal space but is not one, a common cause of mysterious string comparison failures.

Because a parser is involved, only decode markup you trust. Treat anything copied from an unknown page as hostile text and do not paste it into decoders you do not control.

Mistakes to avoid

Frequently asked questions

What is an HTML entity?

A text code such as &amp;lt; that the browser shows as a character, so it is not treated as markup.

Does escaping prevent XSS?

It is an important part of it for text placed in HTML, but context matters, so follow your framework's escaping rules too.

Which mode should I use?

Essential for most cases; Full when the page might not be served as UTF-8.

Is my data uploaded?

No. This tool runs entirely in your browser, so what you type or paste is not sent to our servers.

Does it produce named entities like &copy;?

No. Full and Numeric modes write numeric entities such as &#169;. Decoding does understand named entities.

Why did decoding remove my tags?

Decoding uses the browser's HTML parser and returns only the text content, so tags are stripped. Encode the markup first if you want to keep it as text.

Related tools

Explore all developer tools →