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.
Text in, entities out
Entity encoding swaps unsafe characters for their HTML-safe representations so they render verbatim instead of being parsed as markup.
<div class="example">Hello & "world"</div>
<div class="example">Hello & "world"</div>
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.
How to encode HTML entities
Paste your text
Drop it into the left editor. Any Unicode is supported — the encoder is code-point aware.
Pick encoding and scope
Named for readable output, numeric (decimal or hex) for full Unicode coverage. Scope controls how aggressively to encode.
Click Encode
Or leave auto-encode on for live updates. Runs locally — no upload.
Copy or download
Copy to clipboard or save as .html. Or jump straight to the decoder for round-trip checks.
Frequently asked questions
Named like & 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 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 &, ©, … — plus a generic numeric form for every Unicode code point.
Three forms of entity
- Named —
&,<,>,",', and ~250 more. Readable, but only the named ones work. - Numeric decimal —
&#NNN;, e.g.Afor "A". Works for any Unicode code point. - Numeric hex —
&#xNN;, e.g.A. 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).