HTML Entity Encoder

Convert text into HTML-safe markup. Encode only the five special characters to display code or user input safely, or also encode every non-ASCII character for systems that cannot handle UTF-8. Choose named entities like ©, decimal references like © or hexadecimal references like ©.

How to use the HTML Entity Encoder

  1. Choose what to encode: special characters only, non-ASCII too, or everything except letters and digits.
  2. Choose named, decimal or hex entities.
  3. Type or paste your text.
  4. Copy or download the encoded output.

Features

Benefits

Frequently asked questions

Which characters must be escaped in HTML?

In text content & and < must be escaped; inside attribute values the quote character must be too. Escaping all five (& < > " ') is the safe default.

Why is the apostrophe encoded as &#39; instead of &apos;?

&apos; is not defined in HTML 4, so &#39; is used for maximum compatibility with older browsers and email clients.

Is entity encoding enough to prevent XSS?

It protects text placed in HTML content and quoted attributes. Values inside scripts, CSS or URLs need context-specific escaping as well.

Related tools