HTML Entity Encoder

Escape text so it displays as text in HTML — for showing code snippets, user input or special characters — with control over quotes and non-ASCII characters.

Encoded locally in your browser — your code is never uploaded

Quotes
Decode entities →

How it works

  • & → &amp;, < → &lt; and > → &gt;, always.
  • With “Escape quotes” on, " → &quot; and ' → &#39;, so the text is also safe inside attr="…" or attr='…'.
  • Non-ASCII characters are left alone by default (fine for UTF-8 pages). You can also write them as named entities (about 70 common names, such as &mdash; and &eacute;), decimal &#233; or hex &#xE9;. Emoji and other characters outside the Basic Multilingual Plane become a single entity, not broken surrogate pairs.

Example

<p class="note">Fish & chips — R85 “special”</p> becomes &lt;p class=&quot;note&quot;&gt;Fish &amp; chips — R85 “special”&lt;/p&gt;. Put that inside a <pre> and readers see the tag itself instead of a paragraph.

With “Named where possible”, the dash and curly quotes become &mdash;, &ldquo; and &rdquo;.

Frequently asked questions

Which characters must be escaped in HTML?

In text, escape & and < (as &amp; and &lt;); > is usually escaped too. Inside an attribute value, also escape the quote character that surrounds it (&quot; or &#39;). “Essential only” does exactly this.

Do I need to escape accents and emoji?

Not if your page is served as UTF-8, which almost every modern page is. Encode them only for systems that can’t handle UTF-8 — use numeric entities, which work for every character, or named ones for readability.

Is escaping enough to prevent XSS?

Escaping text before inserting it into HTML content or quoted attributes is an essential defence, but context matters: URLs, inline JavaScript and CSS need different handling. Prefer your framework’s built-in escaping.

Is my code sent anywhere?

No. Encoding runs in your browser; nothing you paste is uploaded or stored.

Related tools

Decode every named and numeric HTML entity, list what was found, and fix double-escaped text.

FreeRuns in your browser

Percent-encode a query value, a whole URL or form data, line by line if you like, with double-encoding warnings.

FreeRuns in your browser

Count characters, bytes and SMS segments, and check text against common platform limits.

FreeRuns in your browser

Generate random v4 or time-ordered v7 UUIDs in bulk, in the format you need.

FreeRuns in your browser

Related guides