HTML Entity Encode / Decode

Encode special characters to HTML entities and decode HTML entities back to text. Handles & < > " '. Free, client-side tool.

Everything runs in your browser — your data is never sent to any server.

Why Use the HTML Entity Encoder/Decoder?

When displaying text that contains HTML special characters like <, >, &, or quotes, you must encode them as entities to prevent XSS attacks and rendering issues. Our tool makes encoding and decoding HTML entities simple and reliable with a helpful reference table.

Key Features

  • Encode < > & " ' to their HTML entity equivalents
  • Decode HTML entities back to their original characters
  • Built-in entity reference table for quick lookup
  • Swap button to easily switch between encoding and decoding

How to Use

  1. Select the Encode or Decode tab
  2. Paste your HTML or entity-encoded text in the input area
  3. Click the action button and copy the result

Technical Details

Encoding uses regex replacement for the five core HTML entities: & (&amp;), < (&lt;), > (&gt;), " (&quot;), and ' (&#39;). The ampersand is encoded first to prevent double-encoding. Decoding reverses these replacements. Numeric entities (&#NNN;) are not currently supported.

FAQ

Why should I encode HTML entities?

Encoding prevents browsers from interpreting special characters as HTML markup. This is essential for user-generated content to prevent XSS attacks and display issues.

Does this handle numeric entities like &#60;?

Currently, the tool handles the five named entities (&amp;, &lt;, &gt;, &quot;, &#39;). Numeric entities are not decoded in this version.

Related tools