HTML Entity Encoder
Turn <, >, &, quotes, accents, and symbols into HTML character entities. Choose which characters to encode and whether to output named, decimal, or hex references — all in your browser, no server, no sign-up.
What this tool does
Paste text and get back the same text with special characters turned into HTML character entities. Two independent choices control the result:
- Encode which characters (scope):
- Minimal (default) — only the five characters that HTML and XML treat as
special:
&,<,>,", and'. This is what you need to safely drop text into markup without it being parsed as tags. - All non-ASCII — the five above plus every character above plain ASCII (accents, currency symbols, dashes, emoji), giving pure-ASCII output that survives any encoding.
- Every named character — the five above plus every character that has an HTML5 named entity.
- Minimal (default) — only the five characters that HTML and XML treat as
special:
- Entity format (how each character is written):
- Named (default) — the readable HTML5 name where one exists (
&,©,—), falling back to a decimal reference for characters that have no name. - Decimal — always a decimal numeric reference, e.g.
&,©. - Hex — always a hexadecimal numeric reference, e.g.
&,©.
- Named (default) — the readable HTML5 name where one exists (
Everything runs locally in your browser with WebAssembly. Nothing is uploaded, it works offline once loaded, and there is no sign-up.
Worked example
Input
<a href="x">Tom & Jerry's</a>
Output (scope Minimal, format Named)
<a href="x">Tom & Jerry's</a>
Only the five HTML-sensitive characters change; the letters, spaces, and slashes
are left exactly as they were. Switch the scope to All non-ASCII and an input
like Café © €5 becomes Café © €5 in named format, or
Café © €5 in decimal.
Choosing a scope
| Scope | Encodes | Use it when |
|---|---|---|
| Minimal | & < > " ' only | Inserting untrusted or literal text into HTML/XML so it renders as text, not markup. |
| All non-ASCII | the five + every char above U+007F | You need pure-ASCII output (email, legacy systems, Content-Type you can't trust). |
| Every named character | the five + every char with an HTML5 name | You want the most human-readable entities across the whole HTML5 named set. |
The five HTML/XML-sensitive characters are always encoded, whatever scope you pick — so the output is never unsafe to embed.
Choosing a format
- Named is the most readable and is what most hand-written HTML uses:
©,—, . Characters without a name (many symbols, all emoji) fall back to a decimal reference automatically. - Decimal and Hex are universal: every character has a numeric code, so
there is never a fallback. Hex matches the style used in CSS and many specs
(
©). Both decimal and hex render identically in every browser.
Details worth knowing
- The apostrophe. In named format
'becomes'(an HTML5 name); in decimal/hex it becomes'/', which older HTML4 parsers also accept. Pick a numeric format if you need maximum compatibility. - Canonical names. Where a character has several aliases (
&and&), the tool always outputs the standard lowercase form. - Already-encoded text is re-encoded. Running
&through again yields&amp;, because the tool encodes the literal&. Encode raw text once, not text that already contains entities. - Round trips. Any output here decodes back to the original with the companion HTML Entity Decoder tool.
Common entities
| Character | Named | Decimal | Hex |
|---|---|---|---|
& | & | & | & |
< | < | < | < |
> | > | > | > |
" | " | " | " |
' | ' | ' | ' |
© | © | © | © |
— | — | — | — |
€ | € | € | € |
FAQ
Is my text uploaded anywhere?
No. Encoding happens entirely in your browser with WebAssembly — your input never leaves your device, and the tool keeps working offline once the page has loaded.
Which characters does "Minimal" encode, and why only those?
Minimal encodes exactly the five characters HTML and XML treat as special:
&, <, >, ", and '. Encoding just these makes any text safe to place
inside markup without it being parsed as a tag, attribute, or entity — while
leaving everything else readable.
What's the difference between named, decimal, and hex output?
They are three ways to write the same character. Named uses a keyword
(©), decimal uses the Unicode code point in base 10 (©), and
hex uses it in base 16 (©). All three decode to the identical
character in every browser; named is the most readable, numeric formats never
need a fallback.
Why did an emoji become 😀 instead of a name?
Emoji and many symbols have no HTML5 named entity, so in named format the
tool falls back to a decimal numeric reference (😀). Choose decimal
or hex format if you want every encoded character written numerically.
Does it re-encode text that already contains entities?
Yes. The tool encodes the literal characters it sees, so a stray & in an
existing entity like & gets re-encoded to &.
Encode raw, un-encoded text once — don't run already-encoded HTML through it.
How do I turn entities back into normal characters?
Use the companion HTML Entity Decoder tool, which reverses every format this encoder produces — named, decimal, and hex references all decode back to the original text.
Developer & Automation Access
Run it from the terminal
Same engine as this page, headless — via the gizza CLI:
gizza tool html-entity-encoder "<b>Tom & Jerry's café</b> — €5"New to the CLI? Get gizza →
Open it by URL
Pre-fill and auto-run this tool with query parameters — the names match the API/CLI:
https://gizza.ai/tools/html-entity-encoder/?text=%3Cb%3ETom%20%26%20Jerry%27s%20caf%C3%A9%3C%2Fb%3E%20%E2%80%94%20%E2%82%AC5&scope=minimal&format=namedMachine-readable descriptor: tool.json — title + parameters JSON Schema for agents.
