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
- Escape mode replaces
&,<,>,"and'with&,<,>,"and'in a single pass, so the ampersand is never double-escaped - Unescape mode maps those five entities back to their plain characters
- The result is rendered inside a
<pre>block so entities stay readable without the browser decoding them - Character counts are reported before and after conversion
About HTML Entity Escaper
An HTML entity is a sequence that starts with an ampersand and ends with a semicolon — for example, < 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 < into &lt;. And beware of double escaping: escaping the same text twice produces entities such as &lt;, which browsers display literally instead of decoding.