100% Client-Side WASMZero Remote NetworkVerified Spec

HTML Escape

Interactive Studio

Escape or unescape HTML special characters like <, >, &, and quotes. Instant feedback with zero server storage.

Loading tool…

About HTML Escape

HTML reserves a handful of characters for its own syntax — < and > delimit tags, & starts a character entity, and quote marks bound attribute values. When any of these appear in text that's meant to be displayed literally rather than parsed as markup, they have to be replaced with their entity equivalents: & becomes &amp;, < becomes &lt;, > becomes &gt;, " becomes &quot;, and ' becomes &#39;. This tool performs that substitution in either direction — escaping raw text for safe embedding in HTML, or unescaping entities back into their literal characters.

Escaping matters beyond just visual correctness. If user-supplied text is inserted into a page without escaping it first, a string like <script>alert(1)</script> would be parsed as an actual script tag by the browser rather than displayed as text — this is the root mechanism behind cross-site scripting (XSS) vulnerabilities. Escaping the five reserved characters neutralizes that by ensuring the browser renders them as visible text instead of markup.

Common uses include preparing code snippets or user comments for embedding in a web page, decoding entity-laden text copied from a browser's "view source," and cleaning up HTML exported from a CMS or RSS feed before pasting it somewhere else.

How to use HTML Escape

  1. Choose Escape or Unescape.
  2. Paste the text or HTML.
  3. Copy the converted output.

Worked examples

Input: <a href="x">Tom & Jerry</a>

Result: &lt;a href=&quot;x&quot;&gt;Tom &amp; Jerry&lt;/a&gt;

Background

In HTML, < and > start tags, & starts an entity and quotes delimit attribute values. To display these characters literally, they are replaced with entities: &lt;, &gt;, &amp;, &quot;.

Escaping user-provided text before inserting it into a page is the core defense against cross-site scripting (XSS). Escape at output time, in the right context, using your framework's built-in escaping, and do not rely on this tool as a replacement.

Common mistakes

  • Escaping twice, which shows &amp;lt; on the page.
  • Escaping for HTML text and then using the result inside a JavaScript or URL context, where different rules apply.
  • Believing escaping alone makes untrusted HTML safe to render.

Frequently Asked Questions

Why does escaping matter beyond just how the text looks?
Unescaped angle brackets and quotes let a browser interpret pasted text as actual HTML or script rather than plain content — this is the underlying cause of cross-site scripting (XSS) issues when user input is inserted into a page without escaping.
Which characters get converted?
Five: & (&amp;), < (&lt;), > (&gt;), " (&quot;), and ' (&#39;). These are the characters HTML treats as syntax rather than literal content, so they're the ones that need entity equivalents to display correctly.
Does unescape recognize &apos; as well as &#39;?
Yes — both are accepted as equivalent representations of an apostrophe when unescaping, even though only &#39; is produced when escaping, since &apos; isn't a standard HTML4 entity though it is valid in XML and most browsers.
Will this escape entities that are already escaped?
Yes, escaping mode acts on the literal characters in your input regardless of whether they're already part of an entity, so running already-escaped text through escape mode again will double-encode the ampersands.

Fast, local-first developer micro-tools with zero tracking or latency.

Browse All Tools
Local-First Architecture: Toolium parses payloads exclusively in browser memory. Zero network telemetry.
⌘C Copy⌘K Palette