& < > " '. Extended encodes all non-ASCII characters as well. Choose between named entities (&), decimal (&) or hexadecimal (&).How it works
HTML entities represent characters that have special meaning in markup (< > & " ') or that are not ASCII, using sequences like <, &, or ©. This way the browser shows them as text instead of interpreting them as code.
There are three equivalent formats: named (©), decimal (©), and hexadecimal (©). All three produce the same character; the named one is more readable but only exists for a known set.
The "essential" scope escapes only the characters that break HTML (& < > " '); the "all" scope also escapes any non-ASCII character.
Examples
<a href="#"><a href="#">Escaping prevents the browser from interpreting the tags and shows them as text.5 < 10 & 3 > 15 < 10 & 3 > 1© 2024 · €© 2024 · €With "all" scope and named format. In decimal they would be © and €; in hexadecimal, © and €.Use cases
- Show HTML code as text on a page (examples, documentation) without it being rendered.
- Escape user input before inserting it into HTML to prevent XSS.
- Insert special symbols (©, €, →, ½) portably across encodings.
- Decode text with entities copied from a page's source code.
Frequently asked questions
Which format is best: named, decimal, or hexadecimal?
The named one (©) is the most readable, but only covers characters with a defined name. The decimal (©) and hexadecimal (©) work for any Unicode character, so they are the safe option for uncommon symbols.
Does encoding entities prevent XSS attacks?
It is an important part, but escaping must be done according to the context (HTML content, attribute, JavaScript, or URL). Do not rely on a single layer: also use the framework's protections.
Which characters must always be escaped?
& < and > in content, and additionally " and ' inside attribute values. The "essential" scope covers exactly that set.
Is my text sent to a server?
No. The encoding and decoding happen entirely in your browser.