HTML entity encoder and decoder

Escape special characters for HTML, or turn entities like & back into text.

Which characters need escaping?

In HTML text, escape & as &amp; and < as &lt;. Inside attribute values, also escape quotes: " as &quot; and ' as &#39;. Escaping user input this way is a key defence against cross-site scripting (XSS).

Tick Encode all non-ASCII to also turn characters like é and emoji into numeric entities, for systems that can't handle UTF-8.

Private

Everything runs in your browser. Nothing you paste is uploaded, logged or stored on a server, so it's safe to use with private data.

Questions

What is &amp;nbsp;?

A non-breaking space: a space that stops two words being split across lines.

Should I escape > too?

It's not strictly required in text, but escaping it as &gt; is harmless and common.

Related tools