Skip to content

Escape HTML Entities

Escape special characters into HTML entities to safely display code or text, or unescape entities back to plain text.

Category: web
Use Case: Displaying Code Snippets in HTML, Preventing HTML Injection in Text, Reading Escaped Content from an API
Privacy: 100% browser-based

Recommended Settings

Pro Tips

  • Escaping converts &, <, >, ", and ' into their HTML entity equivalents so browsers display them as literal characters instead of interpreting them as markup
  • This is essential when displaying raw HTML or code as visible text on a page, preventing it from being rendered or executed
  • Unescaping reverses named and numeric entities (like &amp; or &#38;) back into their original characters
  • Use the swap button to instantly verify a round-trip by feeding the result back in as input

Most Popular

Most developers escape a code snippet before embedding it inside a <pre> or <code> block so it displays correctly instead of being parsed as HTML

When to Use This Tool

Displaying Code Snippets in HTML

Escape angle brackets and quotes so example code displays correctly instead of rendering as markup.

Preventing HTML Injection in Text

Safely escape user-generated text before inserting it into an HTML page.

Reading Escaped Content from an API

Unescape HTML entities returned by an API or CMS back into plain readable text.

Debugging Rendering Issues

Check whether text is properly escaped when troubleshooting unexpected HTML rendering.

How It Works

1

For escaping, replace each special character (&, <, >, ", ') with its corresponding named HTML entity

2

For unescaping, use the browser's own HTML parser to decode named and numeric entities back to their original characters

3

Display the converted result immediately as you type

100% Private

Files never leave your device. All processing happens locally in your browser.

Lightning Fast

Powered by Client-side HTML entity encoding for optimal performance on modern browsers.

Open Source

Built with verified, open-source libraries. Fully transparent.

Frequently Asked Questions

Why escape & first?

The ampersand itself starts every HTML entity, so it must be escaped first to avoid accidentally double-escaping entities that are later created from other characters.

Does unescaping support numeric entities like &#169;?

Yes, both named entities (&amp;) and numeric entities (&#38; or &#x26;) are correctly decoded back to their original characters.

Is this the same as URL encoding?

No, HTML entity escaping is specifically for safely displaying characters within HTML markup, while URL encoding (percent-encoding) is for safely including characters in a URL.

Is my text sent anywhere?

No. All escaping and unescaping happens locally in your browser.