Skip to contentSkip to the inputSkip to the result

HTML entity converter

Escape markup characters or restore HTML entities as text.

Loading tool

Instructions

HTML entity converter

How to use

  1. Choose escape or unescape and enter the text.
  2. Copy the result.

Supported input

  • Letters outside ASCII can also be written as numeric entities.
  • Decoded HTML is displayed as text and is never executed.

Input example

<p>

Result example

&lt;p&gt;

Troubleshooting

  • Check required inputs, numeric ranges and the selected conversion direction.

How it works

  • Escape markup characters or restore HTML entities as text.

HTML entities: where escaping helps, and the odd rules of decoding

When it comes in handy

  • Pasting a code sample into a blog or CMS in HTML mode, so the tags show as text instead of rendering
  • Dropping a customer name or product title into a hand-built email template that does no escaping of its own
  • Cleaning up RSS items, scraped pages or old database rows still full of &#39; and &quot;
  • Getting accented letters and symbols through an old page served as Windows-1252 or EUC-KR without them turning into question marks

Worked example: showing a link tag as text

  1. 1Escaping <a href="/search?q=a&b=2" title='Tom'> with the default setting gives &lt;a href=&quot;/search?q=a&amp;b=2&quot; title=&#x27;Tom&#x27;&gt;.
  2. 2With Also non-ASCII letters, the symbols switch to decimal references as well: &#60;a href=&#34;/search?q=a&#38;b=2&#34; title=&#39;Tom&#39;&#62;.
  3. 3In that mode café 한글 € becomes caf&#233; &#54620;&#44544; &#8364;, and the emoji 😀 is written as a single reference to its code point, &#128512;, not as two surrogate halves.
  4. 4Numeric references mean the same character whatever encoding the page declares, which is what makes them useful for systems you cannot switch to UTF-8.

Decoding follows the HTML Standard

The HTML Standard lists 2,231 named references, and 106 of them are also recognised without the closing semicolon so that old pages keep working. That is why &copy 2026 decodes to © 2026 and a bare &lt to <. The standard's own example, &notit;, comes out as ¬it; rather than ∉: the legacy name &not matches first (&notin; on its own is ∉).

Numeric references have exceptions too. Most codes from &#x80; to &#x9F; are read as the Windows-1252 characters at those positions, so &#x80; is €, and &#0; becomes the replacement character �. Text that is not a known reference, such as &bogus; or AT&T, is left exactly as it is. To get what a browser would show, a decoder has to follow these rules; the he library this tool uses does.

Each place in a page needs its own treatment

Entity escaping protects two places: text between tags, and attribute values wrapped in double or single quotes. An unquoted attribute (title=value) ends at the first space, so always quote attribute values.

Everywhere else needs a different rule. A value inside <script> or an event handler such as onclick needs JavaScript string escaping; a value inside href needs percent-encoding; a value inside style needs CSS escaping; and a javascript: URL in an href runs no matter how well it is escaped. The OWASP Cross Site Scripting Prevention Cheat Sheet is organised around exactly these contexts. In application code, let your template engine's automatic escaping do this rather than escaping strings by hand.

Mistakes that show up on screen

  • Escaping once when saving and again when rendering, so readers see &amp; in the text. Escape once, at output.
  • Escaping a whole HTML document when only one value was meant to go into it, so every tag turns into visible text.
  • Pasting numeric-mode output into JSON or a JavaScript string: &#54620; only means 한 inside HTML; anywhere else it is just eight characters.

Checked

Frequently asked questions

Which characters does escaping change?

Six: & < > " ' ` become &amp; &lt; &gt; &quot; &#x27; &#x60;. Other characters, such as © or Korean, stay as they are, unless you set Characters to encode to Also non-ASCII letters: then é becomes &#233; and 한 becomes &#54620;.

Can it decode &nbsp; or numeric entities?

Yes. Named entities such as &copy; and &nbsp; and decimal or hex numeric entities such as &#54620; and &#xD55C; are all decoded. Both numeric examples are 한.

Why do I see &amp;lt; in my text?

Escaping text that was already escaped turns & into &amp; again. Decoding also removes one layer at a time, so &amp;lt; becomes &lt; and needs a second pass to become <.