HTML Entity Encoder

Encode HTML special characters to entities, or decode entities back to characters.

Ad
Raw HTML
HTML Entities
Common HTML entities — click to insert
Ad

About HTML Entities

HTML entities are special codes used to represent characters that have special meaning in HTML, or characters that can't be typed directly. The five characters that must be escaped in HTML are: & (ampersand → &amp;), < (less-than → &lt;), > (greater-than → &gt;), " (double quote → &quot;), and ' (single quote → &#39;). Failing to escape these in user-generated content is one of the leading causes of XSS (Cross-Site Scripting) vulnerabilities.

HTML entities can also represent characters not available on standard keyboards, like copyright symbols (&copy; → Ā©), em dashes (&mdash; → —), and mathematical symbols. This encoder handles both named entities and numeric (decimal and hex) entities.


How to Use

  1. Choose Encode to convert special characters to HTML entities, or Decode to reverse.
  2. Paste or type text in the left panel — the result appears instantly on the right.
  3. Click any entity in the reference grid to insert it into the input field.
  4. Click āæ» Copy to copy the output, or ⇄ Swap to flip input and output.

Frequently Asked Questions

Any time you insert user-provided or untrusted text into an HTML document. If a user types <script>alert('XSS')</script> and you display it without encoding, the browser executes it as JavaScript. HTML entity encoding ensures the text is displayed literally instead. Always encode before inserting into HTML — including attributes, text nodes, and title elements.

Named entities use descriptive names: &amp;, &copy;, &mdash;. Numeric entities use the Unicode code point as a decimal (&#169;) or hexadecimal (&#xA9;) number. Named entities only exist for a subset of characters; numeric entities work for every Unicode character. Both forms are valid HTML and display identically in browsers.

No. All encoding and decoding happens entirely in your browser. Nothing is sent to any server.

Ad