HTML Entity Escaper

Escape text or code into HTML entities (&, <, >, ", ') or unescape entities back into plain text — useful before pasting code into <pre>/<code> blocks.

Input

How it works

About HTML Entity Escaper

An HTML entity is a sequence that starts with an ampersand and ends with a semicolon — for example, &lt; renders the < character. Browsers treat entities as literal characters instead of markup, which makes them the safe way to include reserved characters such as <, >, & and quotes in HTML text.

Escape code samples before pasting them into <pre> or <code> blocks so the tags inside your sample display as text instead of being parsed by the browser. Escaping also helps prevent XSS when user-generated content is inserted into a page, and it is a regular part of writing blog posts about code. Always escape the ampersand first, because every entity starts with one — escaping & last would turn the ampersand of an already-escaped &lt; into &amp;lt;. And beware of double escaping: escaping the same text twice produces entities such as &amp;lt;, which browsers display literally instead of decoding.