Skip to content
Jellykit

HTML Entity Encoder

Escape text for HTML as markup-only, named or numeric entities, or decode entities back to characters.

  • Runs on your device
Loading tool

About HTML Entity Encoder

Paste text that has to sit inside a web page and get it back with the characters HTML treats specially escaped: & < > and, for attribute values, both kinds of quote. Choose Named or All non-ASCII to also turn accented letters, symbols and emoji into references, so the result survives any encoding as plain ASCII.

Switch Direction to Decode to go the other way. Decoding follows the same rules a browser uses, including references written without a semicolon and every name HTML defines.

How it works

  1. Every mode replaces & < and > with &amp; &lt; and &gt;, and the double and single quote with &quot; and &#39; unless you turn quotes off.
  2. Named uses the names HTML 4 defined (&eacute;, &mdash;, &euro; and 245 more) and numbers for every other non-ASCII character. All non-ASCII uses numbers throughout, in decimal or hex.
  3. Emoji and other characters outside the Basic Multilingual Plane become a single reference to their code point, never two surrogate halves.
  4. Decoding reads decimal and hex references itself and asks the browser’s HTML parser for named ones, in an inert document that runs nothing, so all of HTML’s names are understood.

Questions

Which mode should I use?

Markup only is enough for a page saved as UTF-8, which is almost every page today. Use Named or All non-ASCII when the text must pass through a system that mangles non-ASCII characters, such as an old database or email template.

Why is the apostrophe written as &#39; and not &apos;?

&apos; was not part of HTML 4, so some older parsers and email clients show it literally. The numeric form works everywhere.

Is encoded text safe to put anywhere in a page?

It is safe as element text and inside a quoted attribute value. It is not enough inside a script block, a style block or an unquoted URL, which each need escaping of their own.

Does decoding run any HTML I paste?

No. Only the entity names themselves are handed to the browser’s parser, in a document that never runs scripts or loads anything. The rest of the text is never parsed as HTML.

How much text can it take?

Up to 5 MB of text. Larger input is refused with a message rather than slowing the page down.

Everything you enter here is processed in this browser tab. Nothing is uploaded, logged or shared. How privacy works here.