Encode text as HTML entities or decode entities back into readable text.
Loading tool
About HTML Entities
Encode text as HTML entities or decode entities back to characters. Encoding always escapes &, < and > (and optionally " and '), and can use named (©), decimal (©) or hex (©) entities, either only for characters with a named entity or for every non-ASCII character. Decoding uses the browser's HTML parser, so it understands all named entities as well as decimal and hex references.
Common uses
- Escape a code sample so it displays as text inside an HTML page.
- Make text safe to place inside an HTML attribute value.
- Decode &, " and ' sequences in scraped HTML or an API response.
- Convert accented characters and symbols to ASCII-only entity references.
FAQ
- Which characters must be escaped in HTML?
- In text content, & and < must be escaped, and > is usually escaped too. Inside a quoted attribute value, the quote character used to delimit it must also be escaped.
- What is the difference between named and numeric entities?
- Named entities like © are readable aliases for a fixed set of characters. Numeric references (© or ©) can represent any Unicode code point, so they work for characters without a name.
- Does encoding HTML entities prevent XSS?
- Escaping is a key part of preventing XSS when inserting text into HTML content and quoted attributes, but it is not enough in other contexts such as JavaScript, CSS or URLs, which need their own escaping.