Contact

Tools  /  Encoding  /  HTML Entity Encoder / Decoder

HTML Entity Encoder / Decoder

Encode text to HTML entities (named, decimal or hex) and decode them back — side-by-side, live, with a full reference.

What this tool does

Text encodes into HTML entities and decodes back, side by side and live, in named (©), decimal (©), or hex (©) form.

Choosing how aggressively to escape

Not every situation needs the same amount of escaping, so three levels are available:

  • Reserved only — just the characters that are actually syntax-critical in HTML: &, <, >, ", and the apostrophe. Nothing else is touched.
  • Reserved plus non-ASCII — the same, plus every character outside the basic ASCII range, so accented letters, symbols, and emoji all become entities too.
  • All non-alphanumeric — the most aggressive option, escaping anything that is not a plain letter or digit.

The right level depends on where the text is going — inserting into an existing HTML document usually only needs the reserved characters handled, while generating something meant to survive being pasted through less careful tooling benefits from escaping more.

Decoding the way a browser actually reads HTML

Rather than matching entities against a lookup table, decoding hands the text to the browser's own HTML parser and reads back what it produces — the same mechanism that actually renders a page, so obscure or malformed entities are handled exactly as a real browser would handle them, not approximately.

A correctness detail: the apostrophe

The apostrophe encodes as &#39; here rather than the more obvious-looking &apos;, because &apos; was never part of the HTML4 named-entity set and historically was not recognized by every browser — the numeric form works everywhere without exception.

Privacy

Encoding and decoding both happen in your browser. Nothing you paste, drop, or load from a file is sent to a server.

Frequently asked questions

Is my data uploaded anywhere?
No. Encoding and decoding both run locally in the browser — nothing is sent to a server.
What is the difference between the three encoding scopes?
Reserved only escapes exactly the characters that are syntax-critical in HTML. Reserved plus non-ASCII adds every character outside the basic ASCII range on top of that. All non-alphanumeric is the most aggressive, escaping anything that is not a plain letter or digit.
Why does the apostrophe encode as &#39; instead of &apos;?
' was never part of the original HTML4 named-entity set and was not reliably recognized by every browser historically. ', the numeric form, represents the same character and works everywhere without exception.
Named, decimal, or hex entities -- which should be used?
All three represent the same characters and decode identically. Named entities like &copy; are the most readable in source code where a name exists for the character; decimal and hex forms work for any character at all, including ones with no named entity.
How accurate is the decoding compared to how a browser actually reads HTML?
It uses the browser's own HTML parser to decode rather than a hand-built lookup table, so the result matches exactly how a real browser would interpret the same entities, including edge cases a simplified table-based decoder might miss.
Can line breaks be converted into <br> tags?
Yes — an option converts each newline in the input into a literal
tag during encoding, for text going somewhere that needs an explicit line break rather than a raw newline character.
Theme Accent