HTML Entity Encoder/Decoder

Encode and decode HTML entities to prevent XSS attacks and display special characters properly on web pages.

Common HTML Entities

< → &lt;
> → &gt;
& → &amp;
" → &quot;
' → &#39;
© → &copy;
® → &reg;
â„¢ → &trade;

Features

  • Encode all special HTML characters
  • Decode HTML entities to original text
  • Prevent XSS attacks
  • Support for named and numeric entities
  • Copy to clipboard functionality
  • No data stored - completely private

HTML Entity Encoder/Decoder FAQs

Which characters does the encoder escape?

Eight in total: ampersand, less-than, greater-than, double quote, and single quote, plus the forward slash, backtick, and equals sign. The last three are emitted as numeric hex entities (&#x2F;, &#x60;, &#x3D;) because they matter in attribute-injection contexts, going beyond the basic five characters needed for display.

Does decoding handle named and numeric entities?

Yes, both. Decoding is performed by the browser's own HTML parser, so any entity it understands is restored, whether it is a named form like &copy; and &trade;, a decimal form like &#38; (ampersand), or a hexadecimal one. Encoding, by contrast, produces the fixed set listed above.

What happens if I encode text that is already encoded?

It double-encodes, correctly. The ampersand in &amp; is itself escaped to &amp;amp;, so each pass adds one layer of encoding, and each decode pass removes exactly one layer. This makes the tool predictable when you are preparing text that will be decoded later by another system.

Is entity encoding enough to stop XSS attacks?

Escaping these characters is the standard defense when inserting untrusted text into HTML, because it neutralizes the characters that build tags and attributes. It is one layer, not a complete strategy: keep validating input server-side and avoid inserting untrusted strings into script contexts or URLs.

What happens to the text I paste into the tool?

It stays in the two textareas on the page. Encoding and decoding run as local JavaScript, nothing is stored, and the Clear button wipes both fields instantly.