Escape HTML Entities

Turn <, >, &, " and ' into HTML entities so text shows as code, or turn them back.

Escape HTML Entities— runs in your browser

How to use it

  1. Choose Escape or Unescape.
  2. Paste text into Input. The result updates as you type.
  3. Copy the result.

About

To show HTML or XML as text on a web page, in a blog post or in documentation, the characters that start tags and entities have to be written as entities, or the browser treats them as markup. Escaping changes five characters:

Character Becomes
& &amp;amp;
< &amp;lt;
> &amp;gt;
" &amp;quot;
' &amp;#39;

Unescape does the reverse, one level at a time, so &amp;amp;lt; becomes &amp;lt;. Everything happens in your browser.

Questions

Why only five characters?

They’re the only ones with special meaning in HTML text and attributes. Other characters, like accented letters or emoji, display fine in a UTF-8 page.

Is this enough to make user input safe?

Escaping these characters is what stops text being read as HTML, but if you’re building a site, use your framework’s own escaping rather than copying text through a tool.