HTML Entity Encoder and Decoder
Encode text as HTML named, decimal, or hex character references, or decode them back to plain text.
Runs in your browser — your input is processed on this device and never uploaded.
Input
Enter ordinary text to encode or text containing HTML entities to decode.
Result
Results appear here.
About this tool
On this page
What is HTML entity encoding?
HTML character references stand in for characters that markup would otherwise treat as syntax. Named forms look like &. Decimal numeric forms look like &. Hexadecimal numeric forms look like &.
HTML entity encoder options
- Operation
- Encode (the default) or Decode.
- Input text
- Ordinary text to encode, or text that already contains character references to decode.
- Entity form for encoding
- Named entities (the default), decimal numeric entities, or hexadecimal numeric entities. Decode ignores it.
- Encode all supported characters
- Off by default, which encodes HTML-special characters only. Turn it on to encode every character the named table supports. Decode ignores it.
Why HTML entities are used so much
Angle brackets, ampersands and quotes are not just characters in HTML. They open tags, start entities and delimit attributes. Paste them in as-is and the parser stops treating them as text.
A common shortcut is to replace only & and < by hand and hope that is enough. Attribute context also cares about quotes, and some documents still contain numeric references that a named-only escape will not round-trip. Miss one of those cases and a heading becomes a broken tag.
HTML entity alternatives
URL Encoder and Decoder percent-encodes for query strings and path segments. That is a different grammar: do not URL-encode HTML and expect a browser to treat the result as markup.
Base64 Encoder and Decoder hides bytes so they can travel through text. It does not produce entities a browser will render as characters.
Warning
A context-aware HTML escaper in your own code is the right tool when the input is untrusted and will be injected into a page. This page is a converter. It is not a sanitizer and it is not a complete defense against cross-site scripting.
Things to know about HTML entities
Named references come from the HTML living standard's named character table, which is much larger than the old HTML4 handful of &, <, >, " and . Numeric references can name any Unicode code point the page encoding can represent.
Decoding is forgiving about a mix of named and numeric forms in one string. Encoding always emits one chosen form.
Browse
Find similar tools by category or tag.