HTML Entity Encoder: Escape HTML Characters Online

HTML Entity Encoder: Escape HTML Characters Online

Escape <, >, &, quotes and accents as HTML entities (&lt;, &amp;, &eacute;) in Essential, Named or Numeric mode. Runs entirely in your browser.

Updated November 2026

Reviewed by Rafael Duarte

Shift + Enter to Copy · Shift + ← → for tabs
Encoding Mode:
Text to Encode
0 characters
HTML Entities Output
Speed
—
Privacy
Local Only
Size
0 KB

How the HTML entity encoder works

Paste, pick a mode, copy — three steps

1. Paste your text

Type or paste any string into the input field — plain text, a code snippet, or raw HTML.

2. Choose a mode

The tool opens in Named Entities, which also turns accents and symbols into entities. To escape only & < > " ', switch to Essential; for decimal references on every non-ASCII character, pick Numeric.

3. Copy the result

The output updates live as you type. Click Copy to send it to your clipboard; Shift+Enter also works, but only with the cursor outside the text box.

What this HTML entity encoder does

Escape HTML characters in three encoding modes

Essential mode

Encodes only & < > " ' — the minimum needed to output text safely in HTML content and quoted attributes, and the recommended mode for most cases.

Named entities

Covers accented letters, currency symbols, arrows, Greek letters and math symbols by name (about 250 classic HTML 4 entities such as &eacute; and &euro;); characters outside that list fall back to numeric references.

Numeric entities (&#…;)

Converts every non-ASCII character to a decimal reference — maximum compatibility with older or strict parsers.

Runs entirely in your browser

No text is ever sent to a server — encoding happens locally in JavaScript, instantly.

Examples

Input (mode)
Encoded output
<div> (any mode)
&lt;div&gt;
Tom & Jerry (any mode)
Tom &amp; Jerry
"hello" (any mode)
&quot;hello&quot;
it's (any mode)
it&#39;s
café €10 (Named Entities, the default)
caf&eacute; &euro;10
café €10 (Essential)
café €10 (unchanged: only & < > " ' are escaped)
café €10 (Numeric)
caf&#233; &#8364;10

When you'll need this tool

The most common scenarios people use it for

Preventing XSS

Before rendering user-supplied content in HTML, always encode it first — a <script> tag should show up as text, not execute. This covers HTML text and quoted attributes; inside <script>, URLs, CSS or unquoted attributes, each context needs its own escaping.

Code examples in docs

Display raw HTML tags as readable text inside a <pre> block without the browser interpreting them.

Email templates

Encoding special characters avoids rendering glitches in Gmail, Outlook and Apple Mail.

CMS content input

Makes sure special characters survive the round trip from database to browser without breaking markup.

Sanitizing API responses

Check that your backend's encoding logic actually produces the output you expect before shipping it.

Which mode should you use? Start here

Confusing it with URL encoding

HTML encoding uses entities (< → &lt;); URL encoding uses percent-encoding (< → %3C) — they solve different problems.

Over-encoding everything

Modern UTF-8 pages don't need Named or Numeric entities just for accented letters — Essential mode is enough in most cases.

Relying only on your framework

React, Svelte and Vue auto-escape in normal bindings — manual encoding is only needed with innerHTML or dangerouslySetInnerHTML.

Why encode HTML entities here

Everything runs in your browser via JavaScript, so the text you escape is never sent to, stored on, or logged by a server.

Three modes cover everything from the minimal security baseline (Essential) to maximum compatibility with legacy parsers (Numeric), without needing to memorize which named entity maps to which character.

Frequently asked questions

HTML encoding replaces characters with entities (< becomes &lt;) so they display safely inside a document. URL encoding uses percent-encoding (< becomes %3C) so characters survive transmission inside a URL. Use HTML encoding whenever you're inserting content into HTML markup, not a link.

References

Related Tools