HTML Entity Encoder

Escape text so it displays literally in HTML instead of being read as markup. Ampersands, angle brackets and quotes become entities.

Options
Numeric format

Processed in your browser. Nothing you type is uploaded.

How it works

Five characters have special meaning in HTML: & < > " and '. They are replaced with &amp; &lt; &gt; &quot; and &#39; so browsers show them as text. Optionally, every non-ASCII character can be written as a numeric reference, such as &#233; for é, for systems that cannot handle UTF-8.

Rules this tool follows

  • The ampersand is always encoded, so existing entities are escaped too (&amp; becomes &amp;amp;). That is correct when you want to display the entity itself.
  • Quotes are encoded by default, which makes the output safe inside attribute values.
  • Numeric references can be decimal (&#233;) or hexadecimal (&#xE9;).

Example

Input

<p class="note">Tom & Jerry</p>

Output

&lt;p class=&quot;note&quot;&gt;Tom &amp; Jerry&lt;/p&gt;

Common uses

  • Showing HTML or XML code examples on a web page.
  • Putting user-supplied text into templates or attributes.
  • Preparing text for CMS fields that expect HTML.

Limitations and notes

  • Escaping protects HTML text and attribute values. Text placed inside <script>, CSS or URLs needs different escaping for those contexts.

All web text tools