HCODX/HTML Entity Encode
100% browser-based · Named or numeric entities · Unicode-aware

HTML Entity Encode

Encode special characters as HTML entities. Choose named entities for the common five (& < > " ') or full numeric for everything outside ASCII. Safe to drop into HTML, attribute values, or template strings.

Plain text
HTML entities
Encode options
Reverse (Entities → Text)
Input size
0 B
Output size
0 B
Ratio
Status
Ready
Example

Text in, entities out

Entity encoding swaps unsafe characters for their HTML-safe representations so they render verbatim instead of being parsed as markup.

Plain text
<div class="example">Hello & "world"</div>
HTML entities
&lt;div class=&quot;example&quot;&gt;Hello &amp; &quot;world&quot;&lt;/div&gt;
Use cases

What you'll use this for

Entity encoding keeps user input, template values, and special characters from being interpreted as markup or executable code.

User-generated content

Sanitize text from users before injecting into HTML.

Email templates

Escape variable values in HTML email templates.

Debugging HTML rendering

See exactly what a renderer is interpreting.

Static site escaping

Escape </>/& in plain-text page content.

Step by step

How to encode HTML entities

1

Paste your text

Drop it into the left editor. Any Unicode is supported — the encoder is code-point aware.

2

Pick encoding and scope

Named for readable output, numeric (decimal or hex) for full Unicode coverage. Scope controls how aggressively to encode.

3

Click Encode

Or leave auto-encode on for live updates. Runs locally — no upload.

4

Copy or download

Copy to clipboard or save as .html. Or jump straight to the decoder for round-trip checks.

FAQ

Frequently asked questions

Named like &amp; are readable but limited to ~250 characters. Numeric (decimal or hex) covers every Unicode code point.

Yes — &, <, >, ", ' are encoded in minimal mode (the safe-for-attribute set).

Yes.

HTML Escape (tool) only does the minimal 5 chars as named entities. This tool gives more control (numeric, non-ASCII).

About

About HTML entity encoding

HTML entities are escape sequences that represent characters which would otherwise be parsed as markup (or simply can't be typed directly). The HTML spec defines roughly 250 named entities — like &amp;, &copy;, &hellip; — plus a generic numeric form for every Unicode code point.

Three forms of entity

  • Named&amp;, &lt;, &gt;, &quot;, &apos;, and ~250 more. Readable, but only the named ones work.
  • Numeric decimal&#NNN;, e.g. &#65; for "A". Works for any Unicode code point.
  • Numeric hex&#xNN;, e.g. &#x41;. Same coverage; often more compact.

When to use named vs numeric

  • Named — readable source, fine for the common five plus a handful of symbols.
  • Numeric — guaranteed to work in any HTML parser; the only safe option for arbitrary Unicode.
  • Minimal scope — encode only the five chars that change HTML parsing. Keep prose readable.
  • All non-ASCII scope — encode any character above code point 127 for maximum 7-bit ASCII compatibility (legacy email, channel-limited transports).
Related

Related tools