Escape HTML entities

Escape or unescape HTML entities (replace characters like <,>, &, " and \' with their HTML version)

Escape html entities

Result

Unescape html entities

Result

Frequently Asked Questions

What are HTML entities?

HTML entities are special codes used to represent reserved characters in HTML, as well as invisible characters and characters that are difficult to type with a standard keyboard. For example, since the characters < and > are used to define HTML tags, they must be represented as &lt; and &gt; when you want them to appear as text on a webpage.

Why do I need to escape HTML characters?

Escaping HTML characters is necessary for several reasons:

  • To display special characters that would otherwise be interpreted as HTML code
  • To prevent XSS (Cross-Site Scripting) attacks by sanitizing user input
  • To ensure code snippets display correctly when embedded in HTML documents
  • To safely include user-generated content in web pages
What characters need to be escaped in HTML?

The most common characters that need to be escaped in HTML are:

CharacterEntity NameEntity NumberDescription
<&lt;&#60;Less than sign
>&gt;&#62;Greater than sign
&&amp;&#38;Ampersand
"&quot;&#34;Double quotation mark
'&apos;&#39;Single quotation mark (apostrophe)
How does this tool work?

This tool works by:

  1. For escaping: Converting special HTML characters (<, >, &, ", ') to their corresponding HTML entity codes
  2. For unescaping: Converting HTML entity codes back to their corresponding characters

All processing is done locally in your browser - no data is sent to any server, ensuring your content remains private.