HTML Escape / Unescape Online

Escape or unescape HTML entities instantly in your browser.

INPUT0 chars
OUTPUT

When to use HTML Escape / Unescape

Convert five common HTML-sensitive characters to references, or inspect a limited set of references as text. Use this for small snippets whose exact replacements you want to review.

How to use HTML Escape / Unescape

  1. Choose Escape or Unescape before entering the snippet.
  2. Paste text or load the sample for the selected mode. The output updates immediately.
  3. Review the output and copy it. Changing the mode reprocesses the current input; it does not automatically move output back into input.

Worked example

Example — current tool behavior
Escape: <b>Tom & Sue</b> → &lt;b&gt;Tom &amp; Sue&lt;/b&gt;
Unescape: &amp;lt; → &lt;
Unescape: &copy; → &copy; (unchanged)

How the tool handles input

Escape replaces ampersand first, then less-than, greater-than, double quote, and apostrophe. Apostrophes become &#39;. Unescape recognizes amp, lt, gt, quot, apos, and decimal or hexadecimal numeric references in one pass. Newly decoded text is not decoded again during that pass.

Limitations

This is not a complete HTML entity decoder: named entities such as &copy; and &nbsp; remain unchanged. References require a semicolon. Numeric references decode Unicode scalar values; surrogate and out-of-range references stay unchanged. This is not a full browser HTML-parser implementation and does not apply its legacy numeric-reference remapping. Whitespace-only input is preserved. Escaping is not sanitization, and unescaped output should not be trusted as safe markup.

Frequently asked questions

Why does escaping an entity change it again?

Escape processes every ampersand, including the one in an existing entity. For example, &lt; becomes &amp;lt;. It does not detect already escaped input.

Can this decode every emoji numeric reference?

Yes, valid decimal and hexadecimal numeric references for supplementary Unicode characters are decoded, including emoji. References outside the Unicode range or in the surrogate range are preserved unchanged.

Which tool offers broader entity decoding?

HTML Entity Encoder / Decoder uses a browser textarea parser for decoding and offers additional encoding modes. This page uses a smaller single-pass decoder.

References

  • The five-character escape set, and why escaping is not sanitization for arbitrary HTML, JavaScript, or URL contexts, is documented in the Python html and Go html reference pages. For contextual auto-escaping in templates, see Go html/template.